Enum mccs_caps::Value

source ·
pub enum Value<'i> {
    String {
        tag: &'i str,
        value: &'i [u8],
    },
    Binary {
        tag: &'i str,
        data: &'i [u8],
    },
}
Expand description

An entry from a capability string

Variants§

§

String

Fields

§tag: &'i str

The value name

§value: &'i [u8]

String contents

A normal string

§

Binary

Fields

§tag: &'i str

The value name

§data: &'i [u8]

Data contents

Raw binary data

Implementations§

source§

impl<'i> Value<'i>

source

pub fn parse_nom( input: &'i [u8], previous_tag: Option<&'i str> ) -> IResult<&'i [u8], Self>

source

pub fn nom_parser() -> ValueParser<'i>

source§

impl<'i> Value<'i>

source

pub fn parse_capabilities(capability_string: &'i [u8]) -> ValueParser<'i>

Create a new iterator over the values in a capability string

source

pub fn parse(data: &'i str) -> Result<Self>

Parse a single capability string entry

source

pub fn parse_bytes(data: &'i [u8]) -> Result<Self>

Parse a single capability string entry

source

pub fn tag(&self) -> &'i str

The value name

Trait Implementations§

source§

impl<'i> Clone for Value<'i>

source§

fn clone(&self) -> Value<'i>

Returns a copy 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<'i> Debug for Value<'i>

source§

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

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

impl<'i> Display for Value<'i>

source§

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

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

impl<'a> From<&'a UnknownTag> for Value<'a>

source§

fn from(v: &'a UnknownTag) -> Self

Converts to this type from the input type.
source§

impl From<Value<'_>> for UnknownTag

source§

fn from(v: Value<'_>) -> Self

Converts to this type from the input type.
source§

impl<'i> Parser<&'i [u8], Value<'i>, Error<&'i [u8]>> for ValueParser<'i>

source§

fn parse(&mut self, input: &'i [u8]) -> IResult<&'i [u8], Value<'i>>

A parser takes in input type, and returns a Result containing either the remaining input and the output value, or an error
source§

fn map<G, O2>(self, g: G) -> Map<Self, G, O>where G: Fn(O) -> O2, Self: Sized,

Maps a function over the result of a parser
source§

fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where G: FnMut(O) -> H, H: Parser<I, O2, E>, Self: Sized,

Creates a second parser from the output of the first one, then apply over the rest of the input
source§

fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>where G: Parser<O, O2, E>, Self: Sized,

Applies a second parser over the output of the first one
source§

fn and<G, O2>(self, g: G) -> And<Self, G>where G: Parser<I, O2, E>, Self: Sized,

Applies a second parser after the first one, return their results as a tuple
source§

fn or<G>(self, g: G) -> Or<Self, G>where G: Parser<I, O, E>, Self: Sized,

Applies a second parser over the input if the first one failed
source§

fn into<O2, E2>(self) -> Into<Self, O, O2, E, E2>where O2: From<O>, E2: From<E>, Self: Sized,

automatically converts the parser’s output and error values to another type, as long as they implement the From trait
source§

impl<'i> PartialEq<Value<'i>> for Value<'i>

source§

fn eq(&self, other: &Value<'i>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'i> Copy for Value<'i>

source§

impl<'i> Eq for Value<'i>

source§

impl<'i> StructuralEq for Value<'i>

source§

impl<'i> StructuralPartialEq for Value<'i>

Auto Trait Implementations§

§

impl<'i> RefUnwindSafe for Value<'i>

§

impl<'i> Send for Value<'i>

§

impl<'i> Sync for Value<'i>

§

impl<'i> Unpin for Value<'i>

§

impl<'i> UnwindSafe for Value<'i>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.