Type Alias json_ld_syntax::NumberBuf

source ·
pub type NumberBuf = NumberBuf<SmallVec<[u8; 16]>>;
Expand description

Number buffer.

Aliased Type§

struct NumberBuf { /* private fields */ }

Implementations

source§

impl<B> NumberBuf<B>

source

pub fn new(data: B) -> Result<NumberBuf<B>, InvalidNumber<B>>
where B: AsRef<[u8]>,

Creates a new number buffer by parsing the given input data buffer.

source

pub unsafe fn new_unchecked(data: B) -> NumberBuf<B>

Creates a new number buffer from the given input data buffer.

§Safety

The input data must hold a valid JSON number string.

source

pub fn from_number(n: &Number) -> NumberBuf<B>
where B: FromIterator<u8>,

Creates a number buffer from the given number.

source

pub fn buffer(&self) -> &B

source

pub fn into_buffer(self) -> B

source§

impl<B> NumberBuf<B>
where B: Buffer,

source

pub fn as_number(&self) -> &Number

Trait Implementations§

source§

impl From<Version> for NumberBuf

source§

fn from(v: Version) -> Self

Converts to this type from the input type.
source§

impl<B> AsRef<[u8]> for NumberBuf<B>
where B: Buffer,

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<B> AsRef<Number> for NumberBuf<B>
where B: Buffer,

source§

fn as_ref(&self) -> &Number

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<B> AsRef<str> for NumberBuf<B>
where B: Buffer,

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<B> Borrow<[u8]> for NumberBuf<B>
where B: Buffer,

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl<B> Borrow<Number> for NumberBuf<B>
where B: Buffer,

source§

fn borrow(&self) -> &Number

Immutably borrows from an owned value. Read more
source§

impl<B> Borrow<str> for NumberBuf<B>
where B: Buffer,

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl<B> Clone for NumberBuf<B>
where B: Clone,

source§

fn clone(&self) -> NumberBuf<B>

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<B> Debug for NumberBuf<B>
where B: Buffer,

source§

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

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

impl<B> Deref for NumberBuf<B>
where B: Buffer,

§

type Target = Number

The resulting type after dereferencing.
source§

fn deref(&self) -> &Number

Dereferences the value.
source§

impl<B> Display for NumberBuf<B>
where B: Buffer,

source§

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

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

impl<B> From<i16> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: i16) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<i32> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: i32) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<i64> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: i64) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<i8> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: i8) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<isize> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: isize) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<u16> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: u16) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<u32> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: u32) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<u64> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: u64) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<u8> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: u8) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> From<usize> for NumberBuf<B>
where B: Buffer,

source§

fn from(i: usize) -> NumberBuf<B>

Converts to this type from the input type.
source§

impl<B> FromStr for NumberBuf<B>
where B: Buffer,

§

type Err = InvalidNumber<B>

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<NumberBuf<B>, <NumberBuf<B> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl<B> Hash for NumberBuf<B>
where B: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<B> Ord for NumberBuf<B>
where B: Ord,

source§

fn cmp(&self, other: &NumberBuf<B>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl Parse for NumberBuf<SmallVec<[u8; 16]>>

source§

fn parse_in<C, E>( parser: &mut Parser<C, E>, context: Context ) -> Result<Meta<NumberBuf<SmallVec<[u8; 16]>>, usize>, Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>,

source§

fn parse_slice(content: &[u8]) -> Result<(Self, CodeMap), Error>

source§

fn parse_slice_with( content: &[u8], options: Options ) -> Result<(Self, CodeMap), Error>

source§

fn parse_str(content: &str) -> Result<(Self, CodeMap), Error>

source§

fn parse_str_with( content: &str, options: Options ) -> Result<(Self, CodeMap), Error>

source§

fn parse_infallible_utf8<C>(chars: C) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = char>,

source§

fn parse_utf8_infallible_with<C>( chars: C, options: Options ) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = char>,

source§

fn parse_utf8<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<char, E>>,

source§

fn parse_utf8_with<C, E>( chars: C, options: Options ) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<char, E>>,

source§

fn parse_infallible<C>(chars: C) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = DecodedChar>,

source§

fn parse_infallible_with<C>( chars: C, options: Options ) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = DecodedChar>,

source§

fn parse<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>,

source§

fn parse_with<C, E>( chars: C, options: Options ) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>,

source§

impl<B> PartialEq for NumberBuf<B>
where B: PartialEq,

source§

fn eq(&self, other: &NumberBuf<B>) -> 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<B> PartialOrd for NumberBuf<B>
where B: PartialOrd,

source§

fn partial_cmp(&self, other: &NumberBuf<B>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Print for NumberBuf<SmallVec<[u8; 16]>>

source§

fn fmt_with( &self, f: &mut Formatter<'_>, _options: &Options, _indent: usize ) -> Result<(), Error>

source§

fn pretty_print(&self) -> Printed<'_, Self>

Print the value with Options::pretty options.
source§

fn compact_print(&self) -> Printed<'_, Self>

Print the value with Options::compact options.
source§

fn inline_print(&self) -> Printed<'_, Self>

Print the value with Options::inline options.
source§

fn print_with(&self, options: Options) -> Printed<'_, Self>

Print the value with the given options.
source§

impl<B> TryFrom<f32> for NumberBuf<B>
where B: Buffer,

§

type Error = TryFromFloatError

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

fn try_from( f: f32 ) -> Result<NumberBuf<B>, <NumberBuf<B> as TryFrom<f32>>::Error>

Performs the conversion.
source§

impl<B> TryFrom<f64> for NumberBuf<B>
where B: Buffer,

§

type Error = TryFromFloatError

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

fn try_from( f: f64 ) -> Result<NumberBuf<B>, <NumberBuf<B> as TryFrom<f64>>::Error>

Performs the conversion.
source§

impl<B> Eq for NumberBuf<B>
where B: Eq,

source§

impl<B> StructuralPartialEq for NumberBuf<B>