Struct proclet::U16Literal

source ·
pub struct U16Literal<S: Span> { /* private fields */ }
Available on crate feature literal-value only.
Expand description

u16 suffixed integer literal. This can be converted to and from LiteralValue.

Implementations§

source§

impl<S: Span> U16Literal<S>

source

pub fn new(value: u16) -> Self

Create a new U16Literal.

source

pub const fn with_span(value: u16, span: S) -> Self

Create a new U16Literal with a custom span.

source

pub const fn value(&self) -> &u16

Get a reference to the value of this token.

source

pub fn value_mut(&mut self) -> &mut u16

Get a mutable reference to the value of this token.

source

pub fn into_value(self) -> u16

Get the value of this token.

source

pub const fn span(&self) -> S

Get the span of this token.

source

pub fn set_span(&mut self, span: S)

Set the span of this token.

Trait Implementations§

source§

impl<S: Clone + Span> Clone for U16Literal<S>

source§

fn clone(&self) -> U16Literal<S>

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<S: Debug + Span> Debug for U16Literal<S>

source§

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

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

impl<S: SpanExt> From<U16Literal<S>> for LiteralValue<S>

source§

fn from(value: U16Literal<S>) -> Self

Converts to this type from the input type.
source§

impl From<U16Literal<Span>> for Literal

Available on crate feature proc-macro only.
source§

fn from(value: U16Literal<Span>) -> Self

Converts to this type from the input type.
source§

impl From<U16Literal<Span>> for Literal

Available on crate feature proc-macro2 only.
source§

fn from(value: U16Literal<Span>) -> Self

Converts to this type from the input type.
source§

impl<T: TokenTreeExt> IntoTokens<T> for U16Literal<T::Span>

source§

fn into_tokens(self) -> impl Iterator<Item = T>

Convert this object into an iterator of tokens representing the object.
source§

impl<T: TokenTreeExt> Parse<T> for U16Literal<T::Span>

source§

fn parse(buf: &mut &TokenBuf<T>) -> Result<Self, Error<T::Span>>

Parse a value from a TokenBuf. Read more
source§

fn parse_all(buf: &mut &TokenBuf<T>) -> Result<Self, Error<T::Span>>

Parse a value from a TokenBuf buffer, but return an error if there’s any tokens left in the buffer after parsing. Read more
source§

impl<T: TokenStreamExt> ToTokenStream<T> for U16Literal<T::Span>

source§

fn extend_token_stream(&self, token_stream: &mut T)

Extend the given TokenStream with a representation of this object.
source§

fn into_token_stream(self) -> T
where Self: Sized,

Make a new TokenStream with a representation of this object.
source§

fn to_token_stream(&self) -> T

Make a new TokenStream with a representation of this object.
source§

impl TryFrom<Literal> for U16Literal<Span>

Available on crate feature proc-macro2 only.
§

type Error = Error<Span>

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

fn try_from(value: Literal) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Literal> for U16Literal<Span>

Available on crate feature proc-macro only.
§

type Error = Error<Span>

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

fn try_from(value: Literal) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<S: SpanExt> TryFrom<LiteralValue<S>> for U16Literal<S>

§

type Error = Error<S>

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

fn try_from(value: LiteralValue<S>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<S> Freeze for U16Literal<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for U16Literal<S>
where S: RefUnwindSafe,

§

impl<S> Send for U16Literal<S>
where S: Send,

§

impl<S> Sync for U16Literal<S>
where S: Sync,

§

impl<S> Unpin for U16Literal<S>
where S: Unpin,

§

impl<S> UnwindSafe for U16Literal<S>
where S: UnwindSafe,

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, X> DefaultParser<T> for X
where T: TokenTreeExt, X: Parse<T>,

§

type Parser = DefaultParserImpl<T, X>

The parser that will be created.
source§

fn parser() -> Self::Parser

Create a new parser.
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> ToOwned for T
where 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, X> ToTokenBuffer<T> for X
where T: TokenTree, X: IntoTokens<T> + Clone,

source§

fn extend_token_buffer(&self, token_buffer: &mut TokenBuffer<T>)

Extend the given TokenBuffer with tokens representing this object.
source§

fn to_token_buffer(&self) -> TokenBuffer<T>

Make a new TokenBuffer with tokens representing this object.
source§

impl<T, X> ToTokens<T> for X
where T: TokenTree, X: IntoTokens<T> + Clone,

source§

fn to_tokens(&self) -> impl Iterator<Item = T>

Get an iterator of tokens representing this object.
source§

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

§

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>,

§

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.