[][src]Struct tynm::TypeName

pub struct TypeName<'s> { /* fields omitted */ }

Organizes type name string into distinct parts.

Methods

impl<'s> TypeName<'s>[src]

pub fn module_path(&self) -> &[&'s str][src]

Returns the module path of the type.

pub fn simple_name(&self) -> &'s str[src]

Returns the simple name of the type, excluding type parameters.

pub fn type_params(&self) -> &[TypeName<'s>][src]

Returns the type parameters to the type.

pub fn as_str(&self) -> String[src]

Returns the type name string without any module paths.

This is equivalent to calling TypeName::as_str_mn(0, 0);

pub fn as_str_mn(&self, m: usize, n: usize) -> String[src]

Returns the type name string with the given number of module segments.

If the left and right module segments overlap, the overlapping segments will only be printed printed once.

Parameters

  • m: Number of module segments to include, beginning from the left (most significant).
  • n: Number of module segments to include, beginning from the right (least significant).

pub fn write_str<W>(
    &self,
    buffer: &mut W,
    m: usize,
    n: usize
) -> Result<(), Error> where
    W: Write
[src]

Writes the type name string to the given buffer.

If the left and right module segments overlap, the overlapping segments will only be printed once.

Parameters

  • buffer: Buffer to write to.
  • m: Number of module segments to include, beginning from the left (most significant).
  • n: Number of module segments to include, beginning from the right (least significant).

pub fn write_module_path<W>(
    &self,
    buffer: &mut W,
    m: usize,
    n: usize
) -> Result<(), Error> where
    W: Write
[src]

Writes the module path to the given buffer.

If the left and right module segments overlap, the overlapping segments will only be printed once.

Parameters

  • buffer: Buffer to write to.
  • m: Number of module segments to include, beginning from the left (most significant).
  • n: Number of module segments to include, beginning from the right (least significant).

pub fn write_simple_name<W>(&self, buffer: &mut W) -> Result<(), Error> where
    W: Write
[src]

Writes the simple name to the given buffer.

Parameters

  • buffer: Buffer to write to.

pub fn write_type_params<W>(
    &self,
    buffer: &mut W,
    m: usize,
    n: usize
) -> Result<(), Error> where
    W: Write
[src]

Writes type parameters to the given buffer.

If the left and right module segments overlap, the overlapping segments will only be printed once.

Parameters

  • buffer: Buffer to write to.
  • m: Number of module segments to include, beginning from the left (most significant).
  • n: Number of module segments to include, beginning from the right (least significant).

Trait Implementations

impl<'s> Clone for TypeName<'s>[src]

impl<'s> Debug for TypeName<'s>[src]

impl<'s> Eq for TypeName<'s>[src]

impl<'s> From<&'s str> for TypeName<'s>[src]

impl<'s> PartialEq<TypeName<'s>> for TypeName<'s>[src]

impl<'s> StructuralEq for TypeName<'s>[src]

impl<'s> StructuralPartialEq for TypeName<'s>[src]

Auto Trait Implementations

impl<'s> RefUnwindSafe for TypeName<'s>

impl<'s> Send for TypeName<'s>

impl<'s> Sync for TypeName<'s>

impl<'s> Unpin for TypeName<'s>

impl<'s> UnwindSafe for TypeName<'s>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.