pub enum VarScope {
Param,
Local,
Field,
}Expand description
Variable scope type for InSymbol
Used to distinguish different kinds of “inner” symbols within a containing symbol (function, struct, etc.).
§Path Format
- Parameter:
my_crate::my_fn::$param::x - Local variable:
my_crate::my_fn::$var::result - Struct field:
my_crate::MyStruct::$field::name
Variants§
Implementations§
Source§impl VarScope
impl VarScope
Sourcepub fn segment(&self) -> &'static str
pub fn segment(&self) -> &'static str
Get the scope segment string
§Examples
assert_eq!(VarScope::Param.segment(), "$param");
assert_eq!(VarScope::Local.segment(), "$var");
assert_eq!(VarScope::Field.segment(), "$field");Sourcepub fn from_segment(s: &str) -> Option<VarScope>
pub fn from_segment(s: &str) -> Option<VarScope>
Parse from a segment string
§Examples
assert_eq!(VarScope::from_segment("$param"), Some(VarScope::Param));
assert_eq!(VarScope::from_segment("$var"), Some(VarScope::Local));
assert_eq!(VarScope::from_segment("$field"), Some(VarScope::Field));
assert_eq!(VarScope::from_segment("foo"), None);Sourcepub fn is_scope_marker(s: &str) -> bool
pub fn is_scope_marker(s: &str) -> bool
Check if a string is a valid scope marker
Trait Implementations§
Source§impl<'de> Deserialize<'de> for VarScope
impl<'de> Deserialize<'de> for VarScope
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<VarScope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<VarScope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for VarScope
impl Serialize for VarScope
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for VarScope
impl Eq for VarScope
impl StructuralPartialEq for VarScope
Auto Trait Implementations§
impl Freeze for VarScope
impl RefUnwindSafe for VarScope
impl Send for VarScope
impl Sync for VarScope
impl Unpin for VarScope
impl UnsafeUnpin for VarScope
impl UnwindSafe for VarScope
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more