Struct opencv::core::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 copy of the value. Read more
1.0.0 · source§

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. Read more
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_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> 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 of course unsafe as it breaks the Rust aliasing rules, but it might 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,

§

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>,

§

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>,

§

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.