[][src]Struct cjdns_core::EncodingSchemeForm

pub struct EncodingSchemeForm { /* fields omitted */ }

A form of an encoding scheme. Form is used as follows to encode a director:

[     director     ] [     form.prefix     ]
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
form.bit_count bits   form.prefix_len bits

Implementations

impl EncodingSchemeForm[src]

pub fn try_new(
    bit_count: u8,
    prefix_len: u8,
    prefix: u32
) -> Result<Self, FormValidationError>
[src]

Instantiates EncodingSchemeForm.

Returns an error in several situations:

  • encoding bit_count value is out of valid range, which is 1..32
  • prefix_len is too small for the provided prefix

pub fn params(&self) -> (u8, u8, u32)[src]

Returns encoding scheme form params in respected order:

  • bit count;
  • prefix length;
  • prefix itself.

pub fn size_bits(&self) -> u8[src]

As a scheme is represented as an array of forms, this function will tell you how many bits of label space is occupied by a representation of a given form.

Trait Implementations

impl Clone for EncodingSchemeForm[src]

impl Copy for EncodingSchemeForm[src]

impl Debug for EncodingSchemeForm[src]

impl Eq for EncodingSchemeForm[src]

impl Ord for EncodingSchemeForm[src]

impl PartialEq<EncodingSchemeForm> for EncodingSchemeForm[src]

impl PartialOrd<EncodingSchemeForm> for EncodingSchemeForm[src]

impl StructuralEq for EncodingSchemeForm[src]

impl StructuralPartialEq for EncodingSchemeForm[src]

Auto Trait Implementations

impl RefUnwindSafe for EncodingSchemeForm

impl Send for EncodingSchemeForm

impl Sync for EncodingSchemeForm

impl Unpin for EncodingSchemeForm

impl UnwindSafe for EncodingSchemeForm

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.