[−][src]Struct const_format::Sliced
Wrapper for writing a range of a string slice.
This is a workaround for not being able to do &string[start..end] at compile-time.
Example
#![feature(const_mut_refs)] use const_format::Sliced; use const_format::{concatc, formatc}; const NUMS: &str = "0123456789"; const SRC: &str = "foo bar baz"; assert_eq!(concatc!(Sliced(NUMS, 1..=4)), "1234"); assert_eq!(concatc!(Sliced(SRC, 0..5), "ros."), "foo bros."); assert_eq!(formatc!("{}", Sliced(NUMS, 4..)), "456789"); assert_eq!(formatc!("{}t", Sliced(SRC, 4..7)), "bart");
Implementations
impl<'a> Sliced<&'a str, Range<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<&'a str, RangeFrom<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<&'a str, RangeFull>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<&'a str, RangeInclusive<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<&'a str, RangeTo<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<&'a str, RangeToInclusive<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<AsciiStr<'a>, Range<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<AsciiStr<'a>, RangeFrom<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<AsciiStr<'a>, RangeFull>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<AsciiStr<'a>, RangeInclusive<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<AsciiStr<'a>, RangeTo<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<'a> Sliced<AsciiStr<'a>, RangeToInclusive<usize>>[src]
pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]
pub const fn const_display_fmt(
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>[src]
&self,
f: &mut Formatter<'_>
) -> Result<(), Error>
Trait Implementations
impl<'a> FormatMarker for Sliced<&'a str, Range<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<&'a str, RangeFrom<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<AsciiStr<'a>, RangeTo<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<AsciiStr<'a>, RangeToInclusive<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<&'a str, RangeFull>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<&'a str, RangeInclusive<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<&'a str, RangeTo<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<&'a str, RangeToInclusive<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<AsciiStr<'a>, Range<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<AsciiStr<'a>, RangeFrom<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<AsciiStr<'a>, RangeFull>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
impl<'a> FormatMarker for Sliced<AsciiStr<'a>, RangeInclusive<usize>>[src]
type Kind = IsNotStdKind
What kind of type this is, this can be one of: Read more
type This = Self
The type after dereferencing,
implemented as type This = Self; for all non-reference types Read more
Auto Trait Implementations
impl<T, R> RefUnwindSafe for Sliced<T, R> where
R: RefUnwindSafe,
T: RefUnwindSafe,
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for Sliced<T, R> where
R: Send,
T: Send,
R: Send,
T: Send,
impl<T, R> Sync for Sliced<T, R> where
R: Sync,
T: Sync,
R: Sync,
T: Sync,
impl<T, R> Unpin for Sliced<T, R> where
R: Unpin,
T: Unpin,
R: Unpin,
T: Unpin,
impl<T, R> UnwindSafe for Sliced<T, R> where
R: UnwindSafe,
T: UnwindSafe,
R: UnwindSafe,
T: UnwindSafe,
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,
pub 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, 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.
pub 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>,