pub struct Str(/* private fields */);
Expand description
Subtype of Value
that represents a string
Implementations§
Source§impl Str
impl Str
Sourcepub fn substr(&self, index: RangeInclusive<&Value>) -> Result<&str, Error>
pub fn substr(&self, index: RangeInclusive<&Value>) -> Result<&str, Error>
String indexing Returns a substring
Although this looks like the IndexingOperationExt trait, it is not because it returns a string instead of a value
Sourcepub fn mut_substr(
&mut self,
index: RangeInclusive<&Value>,
) -> Result<&mut str, Error>
pub fn mut_substr( &mut self, index: RangeInclusive<&Value>, ) -> Result<&mut str, Error>
Mutable string indexing Returns a mutable substring
Although this looks like the IndexingOperationExt trait, it is not because it returns a string instead of a value
Sourcepub fn set_substr(
&mut self,
index: RangeInclusive<&Value>,
value: Value,
) -> Result<(), Error>
pub fn set_substr( &mut self, index: RangeInclusive<&Value>, value: Value, ) -> Result<(), Error>
Replace a set of characters in the string
Although this looks like the IndexingOperationExt trait, it is not because it returns a string instead of a value
Sourcepub fn index_value_to_range(
index: &Value,
) -> Result<RangeInclusive<Value>, Error>
pub fn index_value_to_range( index: &Value, ) -> Result<RangeInclusive<Value>, Error>
Convert an index value to a range, useful for bridging the gap between the IndexingOperationExt trait and the substr functions Can fail if the index is not an array of integers, or if the array is empty
Sourcepub fn to_escaped_string(&self) -> String
pub fn to_escaped_string(&self) -> String
Returns a quoted string, with , \n, \r, \t and “ escaped
Trait Implementations§
Source§impl ArithmeticOperationExt for Str
impl ArithmeticOperationExt for Str
Source§fn arithmetic_op(
self,
right: Self,
operation: ArithmeticOperation,
) -> Result<Self, Error>
fn arithmetic_op( self, right: Self, operation: ArithmeticOperation, ) -> Result<Self, Error>
Error::UnsupportedOperation
will be returned Read moreSource§impl BooleanOperationExt for Str
impl BooleanOperationExt for Str
Source§fn boolean_op(
self,
right: Self,
operation: BooleanOperation,
) -> Result<Value, Error>
fn boolean_op( self, right: Self, operation: BooleanOperation, ) -> Result<Value, Error>
Error::UnsupportedOperation
will be returned Read moreSource§impl<'de> Deserialize<'de> for Str
impl<'de> Deserialize<'de> for Str
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 IndexingOperationExt for Str
impl IndexingOperationExt for Str
Source§impl MatchingOperationExt for Str
impl MatchingOperationExt for Str
Source§fn matching_op(
container: &Self,
pattern: &Value,
operation: MatchingOperation,
) -> Result<Value, Error>where
Self: Sized,
fn matching_op(
container: &Self,
pattern: &Value,
operation: MatchingOperation,
) -> Result<Value, Error>where
Self: Sized,
Error::UnsupportedOperation
will be returned Read more