Struct const_format::Sliced[][src]

pub struct Sliced<T, R>(pub T, pub R);
This is supported on crate feature fmt only.
Expand description

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");

Tuple Fields

0: T1: R

Implementations

Trait Implementations

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

What kind of type this is, this can be one of: Read more

The type after dereferencing, implemented as type This = Self; for all non-reference types Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.