Struct FileNode

Source
pub struct FileNode { /* private fields */ }
Expand description

File Storage Node class.

The node is used to store each and every element of the file storage opened for reading. When XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of nodes. Each node can be a “leaf” that is contain a single number or a string, or be a collection of other nodes. There can be named collections (mappings) where each element has a name and it is accessed by a name, and ordered collections (sequences) where elements do not have names but rather accessed by index. Type of the file node can be determined using FileNode::type method.

Note that file nodes are only used for navigating file storages opened for reading. When a file storage is opened for writing, no data is stored in memory after it is written.

Implementations§

Source§

impl FileNode

Source

pub fn default() -> Result<FileNode>

The constructors.

These constructors are used to create a default file node, construct it from obsolete structures or from the another file node.

Source

pub fn new( fs: &impl FileStorageTraitConst, block_idx: size_t, ofs: size_t, ) -> Result<FileNode>

The constructors.

These constructors are used to create a default file node, construct it from obsolete structures or from the another file node.

§Overloaded parameters
§Parameters
  • fs: Pointer to the file storage structure.
  • blockIdx: Index of the memory block where the file node is stored
  • ofs: Offset in bytes from the beginning of the serialized storage

@deprecated

Source

pub fn copy(node: &impl FileNodeTraitConst) -> Result<FileNode>

The constructors.

These constructors are used to create a default file node, construct it from obsolete structures or from the another file node.

§Overloaded parameters
§Parameters
  • node: File node to be used as initialization for the created file node.
Source

pub fn is_map(flags: i32) -> Result<bool>

Source

pub fn is_seq(flags: i32) -> Result<bool>

Source

pub fn is_collection(flags: i32) -> Result<bool>

Source

pub fn is_empty_collection(flags: i32) -> Result<bool>

Source

pub fn is_flow(flags: i32) -> Result<bool>

Trait Implementations§

Source§

impl Boxed for FileNode

Source§

unsafe fn from_raw(ptr: <FileNode as OpenCVFromExtern>::ExternReceive) -> Self

Wrap the specified raw pointer Read more
Source§

fn into_raw(self) -> <FileNode as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
Source§

fn as_raw(&self) -> <FileNode as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
Source§

fn as_raw_mut( &mut self, ) -> <FileNode as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
Source§

impl Clone for FileNode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for FileNode

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FileNodeTrait for FileNode

Source§

fn as_raw_mut_FileNode(&mut self) -> *mut c_void

Source§

fn set_block_idx(&mut self, val: size_t)

Source§

fn set_ofs(&mut self, val: size_t)

Source§

fn set(&mut self, node: &impl FileNodeTraitConst) -> Result<()>

Source§

fn ptr_1(&mut self) -> Result<*mut u8>

Source§

fn set_value(&mut self, typ: i32, value: &mut [u8]) -> Result<()>

Internal method used when reading FileStorage. Sets the type (int, real or string) and value of the previously created node.
Source§

impl FileNodeTraitConst for FileNode

Source§

fn as_raw_FileNode(&self) -> *const c_void

Source§

fn block_idx(&self) -> size_t

Source§

fn ofs(&self) -> size_t

Source§

fn get(&self, nodename: &str) -> Result<FileNode>

Returns element of a mapping node or a sequence node. Read more
Source§

fn get_node(&self, nodename: &str) -> Result<FileNode>

Returns element of a mapping node or a sequence node. Read more
Source§

fn at(&self, i: i32) -> Result<FileNode>

Returns element of a mapping node or a sequence node. Read more
Source§

fn keys(&self) -> Result<Vector<String>>

Returns keys of a mapping node. Read more
Source§

fn typ(&self) -> Result<i32>

Returns type of the node. Read more
Source§

fn empty(&self) -> Result<bool>

returns true if the node is empty
Source§

fn is_none(&self) -> Result<bool>

returns true if the node is a “none” object
Source§

fn is_seq(&self) -> Result<bool>

returns true if the node is a sequence
Source§

fn is_map(&self) -> Result<bool>

returns true if the node is a mapping
Source§

fn is_int(&self) -> Result<bool>

returns true if the node is an integer
Source§

fn is_real(&self) -> Result<bool>

returns true if the node is a floating-point number
Source§

fn is_string(&self) -> Result<bool>

returns true if the node is a text string
Source§

fn is_named(&self) -> Result<bool>

returns true if the node has a name
Source§

fn name(&self) -> Result<String>

returns the node name or an empty string if the node is nameless
Source§

fn size(&self) -> Result<size_t>

returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
Source§

fn raw_size(&self) -> Result<size_t>

returns raw size of the FileNode in bytes
Source§

fn to_i32(&self) -> Result<i32>

returns the node content as an integer. If the node stores floating-point number, it is rounded.
Source§

fn to_i64(&self) -> Result<i64>

returns the node content as a signed 64bit integer. If the node stores floating-point number, it is rounded.
Source§

fn to_f32(&self) -> Result<f32>

returns the node content as float
Source§

fn to_f64(&self) -> Result<f64>

returns the node content as double
Source§

fn to_string(&self) -> Result<String>

returns the node content as text string
Source§

fn ptr(&self) -> Result<*const u8>

Source§

fn begin(&self) -> Result<FileNodeIterator>

returns iterator pointing to the first node element
Source§

fn end(&self) -> Result<FileNodeIterator>

returns iterator pointing to the element following the last node element
Source§

fn read_raw(&self, fmt: &str, vec: &mut [u8]) -> Result<()>

Reads node elements to the buffer with the specified format. Read more
Source§

fn real(&self) -> Result<f64>

Simplified reading API to use with bindings.
Source§

fn string(&self) -> Result<String>

Simplified reading API to use with bindings.
Source§

fn mat(&self) -> Result<Mat>

Simplified reading API to use with bindings.
Source§

impl Send for FileNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Mat> ModifyInplace for Mat
where Mat: Boxed,

Source§

unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res

Helper function to call OpenCV functions that allow in-place modification of a Mat or another similar object. By passing a mutable reference to the Mat to this function your closure will get called with the read reference and a write references to the same Mat. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data, but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.