Struct full_moon::ast::types::InterpolatedString
source · pub struct InterpolatedString { /* private fields */ }
roblox
only.Expand description
An interpolated string, such as `hello, {"world"}!`
.
“segments”, made up of InterpolatedStringSegment
s, is each part of the string,
up until the last_string
.
The number of segments is the number of expressions used.
For example, `1{2}3`
would have one segment, with literal “1” (marked with a
TokenType
of InterpolatedString { token: "1", kind: InterpolatedStringKind::Begin }
),
and the expression 2
.
The last_string
would be the literal 3, with a backtick afterwards.
Implementations§
source§impl InterpolatedString
impl InterpolatedString
sourcepub fn new(
segments: Vec<InterpolatedStringSegment>,
last_string: TokenReference
) -> Self
pub fn new( segments: Vec<InterpolatedStringSegment>, last_string: TokenReference ) -> Self
Creates a new InterpolatedString from the given segments and last string
sourcepub fn segments(&self) -> impl Iterator<Item = &InterpolatedStringSegment>
pub fn segments(&self) -> impl Iterator<Item = &InterpolatedStringSegment>
The segments of the interpolated string
sourcepub fn last_string(&self) -> &TokenReference
pub fn last_string(&self) -> &TokenReference
The last string of the interpolated string
sourcepub fn expressions(&self) -> impl Iterator<Item = &Expression>
pub fn expressions(&self) -> impl Iterator<Item = &Expression>
Returns just the expressions
sourcepub fn with_segments(self, segments: Vec<InterpolatedStringSegment>) -> Self
pub fn with_segments(self, segments: Vec<InterpolatedStringSegment>) -> Self
Returns a new InterpolatedString with the given segments
sourcepub fn with_last_string(self, last_string: TokenReference) -> Self
pub fn with_last_string(self, last_string: TokenReference) -> Self
Returns a new InterpolatedString with the given last string
Trait Implementations§
source§impl Clone for InterpolatedString
impl Clone for InterpolatedString
source§fn clone(&self) -> InterpolatedString
fn clone(&self) -> InterpolatedString
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InterpolatedString
impl Debug for InterpolatedString
source§impl<'de> Deserialize<'de> for InterpolatedString
impl<'de> Deserialize<'de> for InterpolatedString
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for InterpolatedString
impl Display for InterpolatedString
source§impl Node for InterpolatedString
impl Node for InterpolatedString
source§fn start_position(&self) -> Option<Position>
fn start_position(&self) -> Option<Position>
source§fn end_position(&self) -> Option<Position>
fn end_position(&self) -> Option<Position>
source§fn similar(&self, other: &Self) -> bool
fn similar(&self, other: &Self) -> bool
source§impl PartialEq for InterpolatedString
impl PartialEq for InterpolatedString
source§fn eq(&self, other: &InterpolatedString) -> bool
fn eq(&self, other: &InterpolatedString) -> bool
self
and other
values to be equal, and is used
by ==
.