Trait yang3::data::Data

source ·
pub trait Data {
    // Provided methods
    fn find_xpath(&self, xpath: &str) -> Result<Set<'_, DataNodeRef<'_>>, Error> { ... }
    fn find_path(&self, path: &str) -> Result<DataNodeRef<'_>, Error> { ... }
    fn print_file<F: AsRawFd>(
        &self,
        fd: F,
        format: DataFormat,
        options: DataPrinterFlags,
    ) -> Result<(), Error> { ... }
    fn print_string(
        &self,
        format: DataFormat,
        options: DataPrinterFlags,
    ) -> Result<Option<String>, Error> { ... }
}
Expand description

Methods common to data trees, data node references and data diffs.

Provided Methods§

source

fn find_xpath(&self, xpath: &str) -> Result<Set<'_, DataNodeRef<'_>>, Error>

Search in the given data for instances of nodes matching the provided XPath.

The expected format of the expression is JSON, meaning the first node in every path must have its module name as prefix or be the special * value for all the nodes.

If a list instance is being selected with all its key values specified (but not necessarily ordered) in the form list[key1='val1'][key2='val2'][key3='val3'] or a leaf-list instance in the form leaf-list[.='val'], these instances are found using hashes with constant (O(1)) complexity (unless they are defined in top-level). Other predicates can still follow the aforementioned ones.

source

fn find_path(&self, path: &str) -> Result<DataNodeRef<'_>, Error>

Search in the given data for a single node matching the provided XPath.

The expected format of the expression is JSON, meaning the first node in every path must have its module name as prefix or be the special * value for all the nodes.

source

fn print_file<F: AsRawFd>( &self, fd: F, format: DataFormat, options: DataPrinterFlags, ) -> Result<(), Error>

Print data tree in the specified format.

source

fn print_string( &self, format: DataFormat, options: DataPrinterFlags, ) -> Result<Option<String>, Error>

Print data tree in the specified format.

Object Safety§

This trait is not object safe.

Implementors§