pub struct IpldPathResolver;Expand description
IPLD path resolver for TensorLogic block data
All methods are stateless pure functions that operate on raw block bytes.
Implementations§
Source§impl IpldPathResolver
impl IpldPathResolver
Sourcepub fn resolve_rule_path(
block_data: &[u8],
path: &str,
) -> Result<IpldPathValue, PathError>
pub fn resolve_rule_path( block_data: &[u8], path: &str, ) -> Result<IpldPathValue, PathError>
Resolve an IPLD path against a stored rule block.
block_data must be the raw bytes of a block encoded by
crate::ipld_codec::rule_to_block.
path is the full path string, e.g.
"/rule/bafkrei.../head/args/0". The first two segments (rule and
the CID) are skipped; traversal begins at the third segment.
§Examples
let val = IpldPathResolver::resolve_rule_path(block_data, "/rule/bafk.../head/functor")?;
assert_eq!(val, IpldPathValue::String("grandparent".to_string()));Sourcepub fn resolve_fact_path(
block_data: &[u8],
path: &str,
) -> Result<IpldPathValue, PathError>
pub fn resolve_fact_path( block_data: &[u8], path: &str, ) -> Result<IpldPathValue, PathError>
Resolve a path against a stored fact block.
block_data must be the raw bytes of a block encoded by
crate::ipld_codec::fact_to_block.
path is the full path, e.g. "/fact/bafk.../predicate". The first
two segments are skipped.
Sourcepub fn parse_path(path: &str) -> Vec<String>
pub fn parse_path(path: &str) -> Vec<String>
Parse a path string into non-empty segments by splitting on /.
Leading and trailing slashes are stripped; consecutive slashes are treated as a single separator.
Auto Trait Implementations§
impl Freeze for IpldPathResolver
impl RefUnwindSafe for IpldPathResolver
impl Send for IpldPathResolver
impl Sync for IpldPathResolver
impl Unpin for IpldPathResolver
impl UnsafeUnpin for IpldPathResolver
impl UnwindSafe for IpldPathResolver
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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