Skip to content

struct

Policy

pub struct Policy {
    pub collections: Vec<(String, Access)>,
    pub max_limit: u32,
}

Which collections the browser may use, and how.

Fields

collections

pub collections: Vec<(String, Access)>

The collections allowed, with what each allows.

max_limit

pub max_limit: u32

The largest limit a command may use; larger ones are lowered to it.

Methods

new

pub fn new() -> Policy

A policy allowing nothing, with results limited to 100.

read

pub fn read(self, collection: &str) -> Policy

Allow reading collection.

read_write

pub fn read_write(self, collection: &str) -> Policy

Allow reading and writing collection.

max_limit

pub fn max_limit(self, n: u32) -> Policy

The most documents a read returns (at least 1).

Trait implementations