Struct proc_macro2::Literal [] [src]

pub struct Literal { /* fields omitted */ }

A literal string ("hello"), byte string (b"hello"), character ('a'), byte character (b'a'), an integer or floating point number with or without a suffix (1, 1u8, 2.3, 2.3f32).

Boolean literals like true and false do not belong here, they are Idents.

Methods

impl Literal
[src]

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new suffixed integer literal with the specified value.

This function will create an integer like 1u32 where the integer value specified is the first part of the token and the integral is also suffixed at the end. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

Creates a new unsuffixed integer literal with the specified value.

This function will create an integer like 1 where the integer value specified is the first part of the token. No suffix is specified on this token, meaning that invocations like Literal::i8_unsuffixed(1) are equivalent to Literal::u32_unsuffixed(1). Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Literals created through this method have the Span::call_site() span by default, which can be configured with the set_span method below.

[src]

[src]

[src]

Creates a new unsuffixed floating-point literal.

This constructor is similar to those like Literal::i8_unsuffixed where the float's value is emitted directly into the token but no suffix is used, so it may be inferred to be a f64 later in the compiler. Literals created from negative numbers may not survive rountrips through TokenStream or strings and may be broken into two tokens (- and positive literal).

Panics

This function requires that the specified float is finite, for example if it is infinity or NaN this function will panic.

[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

impl From<Literal> for TokenTree
[src]

[src]

Performs the conversion.

impl Clone for Literal
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Literal
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for Literal
[src]

[src]

Formats the value using the given formatter. Read more