Skip to main content

IdentFragment

Trait IdentFragment 

Source
pub trait IdentFragment {
    // Required method
    fn fmt(&self, f: &mut Formatter<'_>) -> Result;

    // Provided method
    fn span(&self) -> Option<Span> { ... }
}
Expand description

Specialized formatting trait used by format_ident!.

Ident arguments formatted using this trait will have their r# prefix stripped, if present.

See format_ident! for more information.

Required Methods§

Source

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

Format this value as an identifier fragment.

Provided Methods§

Source

fn span(&self) -> Option<Span>

Span associated with this IdentFragment.

If non-None, may be inherited by formatted identifiers.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IdentFragment for Ident

Source§

fn span(&self) -> Option<Span>

Source§

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

Source§

impl IdentFragment for String

Source§

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

Source§

impl IdentFragment for bool

Source§

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

Source§

impl IdentFragment for char

Source§

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

Source§

impl IdentFragment for str

Source§

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

Source§

impl IdentFragment for u8

Source§

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

Source§

impl IdentFragment for u16

Source§

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

Source§

impl IdentFragment for u32

Source§

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

Source§

impl IdentFragment for u64

Source§

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

Source§

impl IdentFragment for u128

Source§

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

Source§

impl IdentFragment for usize

Source§

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

Source§

impl<T: IdentFragment + ?Sized> IdentFragment for &T

Source§

fn span(&self) -> Option<Span>

Source§

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

Source§

impl<T: IdentFragment + ?Sized> IdentFragment for &mut T

Source§

fn span(&self) -> Option<Span>

Source§

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

Source§

impl<T> IdentFragment for Cow<'_, T>
where T: IdentFragment + ToOwned + ?Sized,

Source§

fn span(&self) -> Option<Span>

Source§

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

Implementors§