pub struct TracePath(/* private fields */);
Expand description
A full trace path modelled as a collection of TracePrefix
s.
Internally, the TracePath
is modelled as a Vec<TracePrefix>
but with the order reversed, i.e.
“transfer/channel-0/transfer/channel-1/uatom” => ["transfer/channel-1", "transfer/channel-0"]
This is done for ease of addition/removal of prefixes.
Implementations§
Source§impl TracePath
impl TracePath
Sourcepub fn starts_with(&self, prefix: &TracePrefix) -> bool
pub fn starts_with(&self, prefix: &TracePrefix) -> bool
Returns true iff this path starts with the specified prefix
Sourcepub fn remove_prefix(&mut self, prefix: &TracePrefix)
pub fn remove_prefix(&mut self, prefix: &TracePrefix)
Removes the specified prefix from the path if there is a match, otherwise does nothing.
Sourcepub fn add_prefix(&mut self, prefix: TracePrefix)
pub fn add_prefix(&mut self, prefix: TracePrefix)
Adds the specified prefix to the path.
Sourcepub fn trim(s: &str) -> (TracePath, Option<&str>)
pub fn trim(s: &str) -> (TracePath, Option<&str>)
Returns a string slice with TracePath
or all TracePrefix
es repeatedly removed.
If the string starts with a TracePath
, it returns a tuple of the removed
TracePath
and the substring after the TracePath
.
If the substring is empty, it returns None
.
Otherwise, the substring starts with /
. In that case,
the leading /
is stripped and returned.
If the string does not contain any TracePrefix
, it returns the original string.
This method is analogous to trim_start_matches
from the standard library.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for TracePath
impl<'arbitrary> Arbitrary<'arbitrary> for TracePath
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<TracePath, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<TracePath, Error>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<TracePath, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<TracePath, Error>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§impl BorshDeserialize for TracePath
impl BorshDeserialize for TracePath
fn deserialize_reader<__R>(reader: &mut __R) -> Result<TracePath, Error>where
__R: Read,
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for TracePath
impl BorshSerialize for TracePath
Source§impl Decode for TracePath
impl Decode for TracePath
Source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<TracePath, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<TracePath, Error>where
__CodecInputEdqy: Input,
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl<'de> Deserialize<'de> for TracePath
impl<'de> Deserialize<'de> for TracePath
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TracePath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TracePath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Encode for TracePath
impl Encode for TracePath
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl JsonSchema for TracePath
impl JsonSchema for TracePath
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more