LvsModel

Struct LvsModel 

Source
pub struct LvsModel {
    pub version: u64,
    pub start_id: u64,
    pub named_pattern_cnt: u64,
    pub nodes: Vec<LvsNode>,
    pub tag_symbols: Vec<LvsTagSymbol>,
    /* private fields */
}
Expand description

A parsed LVS trust schema.

See the module docs for which LVS features are supported. Construct via LvsModel::decode (typically via crate::TrustSchema::from_lvs_binary).

Fields§

§version: u64§start_id: u64§named_pattern_cnt: u64§nodes: Vec<LvsNode>§tag_symbols: Vec<LvsTagSymbol>

Implementations§

Source§

impl LvsModel

Source

pub fn decode(input: &[u8]) -> Result<Self, LvsError>

Parse an LVS binary model from its TLV wire bytes.

The top-level LvsModel has no outer TLV wrapper — the input buffer is a sequence of top-level TLV fields (Version, StartId, NamedPatternCnt, *Node, *TagSymbol).

Source

pub fn uses_user_functions(&self) -> bool

Returns true if the loaded schema references any user functions.

Because v0.1.0 does not dispatch user functions, any rule that depends on one will never match a packet. Callers that need bit-exact parity with python-ndn’s evaluation can inspect this flag and refuse to use the schema.

Source

pub fn check(&self, data_name: &Name, key_name: &Name) -> bool

Check whether data_name is allowed to be signed by key_name under this LVS schema. Returns true if:

  1. data_name reaches some node D in the graph, and
  2. D has at least one SignConstraint, and
  3. key_name reaches a node whose id is listed in D.sign_constraints.

Trait Implementations§

Source§

impl Clone for LvsModel

Source§

fn clone(&self) -> LvsModel

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LvsModel

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V