[−][src]Enum tynm::TypeName
Organizes type name string into distinct parts.
Variants
Methods
impl<'s> TypeName<'s>
[src]
pub fn new<T>() -> Self
[src]
Constructs a new TypeName with the name of T
.
This is equivalent to calling std::any::type_name::<T>().into()
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 as_display(&self) -> TypeNameDisplay
[src]
Returns an object that implements fmt::Display
for printing the type
name without any module paths directly with format!
and {}
.
When using this type name in a format!
or similar it is more efficient
to use this display instead of first creating a string.
Example
use tynm::TypeName; let tn = TypeName::new::<String>(); println!("{}", tn.as_display());
pub fn as_display_mn(&self, m: usize, n: usize) -> TypeNameDisplay
[src]
Returns an object that implements fmt::Display
for printing the type
name without any module paths directly with format!
and {}
.
When using this type name in a format!
or similar it is more efficient
to use this display instead of first creating a string.
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).
Example
use tynm::TypeName; let tn = TypeName::new::<String>(); println!("{}", tn.as_display_mn(1, 2));
pub fn write_str<W>(
&self,
buffer: &mut W,
m: usize,
n: usize
) -> Result<(), Error> where
W: Write,
[src]
&self,
buffer: &mut W,
m: usize,
n: usize
) -> Result<(), Error> where
W: Write,
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).
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,