Skip to main content

IdentFragment

Trait IdentFragment 

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

    // 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<(), Error>

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 String

Source§

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

Source§

impl IdentFragment for bool

Source§

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

Source§

impl IdentFragment for char

Source§

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

Source§

impl IdentFragment for str

Source§

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

Source§

impl IdentFragment for u8

Source§

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

Source§

impl IdentFragment for u16

Source§

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

Source§

impl IdentFragment for u32

Source§

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

Source§

impl IdentFragment for u64

Source§

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

Source§

impl IdentFragment for u128

Source§

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

Source§

impl IdentFragment for usize

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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<(), Error>

Implementors§

Source§

impl IdentFragment for Ident

Source§

impl IdentFragment for Index

Available on crate feature printing only.
Source§

impl IdentFragment for Member

Available on crate feature printing only.