Skip to main content

Policy

Struct Policy 

Source
pub struct Policy {
Show 15 fields pub give_vocabularies: bool, pub answer_queries: bool, pub translate: bool, pub vocabularies: Option<BTreeSet<String>>, pub max_message_tokens: u64, pub accept_vocabularies: bool, pub accept_proposals: bool, pub max_frame_bytes: u64, pub max_vocabulary_tokens: u64, pub max_decoded_units: u64, pub max_held_vocabularies: u64, pub max_held_tokens: u64, pub max_inbox_messages: u64, pub max_inbox_bytes: u64, pub replay_window: u64,
}
Expand description

What a peer is willing to do for the other side.

The default takes nothing new from the other side (no vocabularies, no proposals) and gives nothing away (no vocabulary files, no answers about symbols, no translation). It delivers messages encoded under a vocabulary this peer holds, and that is all. Everything else has to be switched on.

Fields§

§give_vocabularies: bool

Send a held vocabulary’s file to the other side when it asks.

§answer_queries: bool

Say whether a held vocabulary has a token for given symbols.

§translate: bool

Re-encode the other side’s sequences under another held vocabulary.

§vocabularies: Option<BTreeSet<String>>

The held vocabularies the other side may use at all, by digest; None is every one held. One that is held but not listed is answered as if it were not held. A vocabulary the other side adds itself (when it may) joins the list.

§max_message_tokens: u64

Refuse a container that declares more tokens than this, before its ids are decompressed. Four bytes of memory per token.

§accept_vocabularies: bool

Take vocabularies it does not have from the other side.

§accept_proposals: bool

Extend a held vocabulary when the other side proposes it.

§max_frame_bytes: u64§max_vocabulary_tokens: u64§max_decoded_units: u64

Refuse a message that would decode to more than this.

§max_held_vocabularies: u64

The most vocabularies this peer will hold, counting its own. The other side cannot add one past this.

§max_held_tokens: u64

The most tokens over all held vocabularies, counting its own.

§max_inbox_messages: u64

Delivered messages kept until take_inbox. When full, a message is answered BUSY and not delivered.

§max_inbox_bytes: u64

Bytes kept until take_inbox: for each message its decoded bytes, its token ids at four bytes each, and its container.

§replay_window: u64

How many of the latest message ids are remembered, so that a repeat gets its first receipt again instead of a second delivery.

Trait Implementations§

Source§

impl Clone for Policy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Policy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Policy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Policy

Source§

impl PartialEq for Policy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Policy

Auto Trait Implementations§

§

impl Forget for Policy

§

impl Freeze for Policy

§

impl Move for Policy

§

impl RefUnwindSafe for Policy

§

impl Send for Policy

§

impl Sync for Policy

§

impl Unpin for Policy

§

impl UnsafeUnpin for Policy

§

impl UnwindSafe for Policy

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.