pub struct SourceParts {
pub display: String,
pub segments: Vec<Segment>,
pub param_names: Vec<String>,
}Expand description
A source text with interpolation holes split out. Spans in every token
and error refer to display, where hole i reads {name_i}.
Fields§
§display: String§segments: Vec<Segment>§param_names: Vec<String>Implementations§
Source§impl SourceParts
impl SourceParts
Sourcepub fn from_parts(parts: &[&str], names: &[&str]) -> SourceParts
pub fn from_parts(parts: &[&str], names: &[&str]) -> SourceParts
Build from pre-split literal parts with holes between them
(the t-string path). names[i] sits between parts[i] and
parts[i+1]; repeated names share one parameter.
Sourcepub fn from_source(src: &str) -> Result<SourceParts>
pub fn from_source(src: &str) -> Result<SourceParts>
Build from a plain string where {identifier} outside quotes is an
interpolation hole (the pre-3.14 and Rust runtime path).
Trait Implementations§
Source§impl Clone for SourceParts
impl Clone for SourceParts
Source§fn clone(&self) -> SourceParts
fn clone(&self) -> SourceParts
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceParts
impl RefUnwindSafe for SourceParts
impl Send for SourceParts
impl Sync for SourceParts
impl Unpin for SourceParts
impl UnsafeUnpin for SourceParts
impl UnwindSafe for SourceParts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more