Struct FileStorage

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

XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or reading data to/from a file.

Implementations§

Source§

impl FileStorage

Source

pub fn default() -> Result<FileStorage>

The constructors.

The full constructor opens the file. Alternatively you can use the default constructor and then call FileStorage::open.

Source

pub fn new(filename: &str, flags: i32, encoding: &str) -> Result<FileStorage>

The constructors.

The full constructor opens the file. Alternatively you can use the default constructor and then call FileStorage::open.

§Overloaded parameters

@copydoc open()

§C++ default parameters
  • encoding: String()
Source

pub fn new_def(filename: &str, flags: i32) -> Result<FileStorage>

@overload @copydoc open()

§Note

This alternative version of [new] function uses the following default values for its arguments:

  • encoding: String()
Source

pub fn get_default_object_name(filename: &str) -> Result<String>

Returns the normalized object name for the specified name of a file.

§Parameters
  • filename: Name of a file
§Returns

The normalized object name.

Trait Implementations§

Source§

impl Boxed for FileStorage

Source§

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

Wrap the specified raw pointer Read more
Source§

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

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

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

Return the underlying raw pointer. Read more
Source§

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

Return the underlying mutable raw pointer Read more
Source§

impl Debug for FileStorage

Source§

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

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

impl Drop for FileStorage

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FileStorageTrait for FileStorage

Source§

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

Source§

fn set_state(&mut self, val: i32)

Source§

fn set_elname(&mut self, val: &str)

Source§

fn open(&mut self, filename: &str, flags: i32, encoding: &str) -> Result<bool>

Opens a file. Read more
Source§

fn open_def(&mut self, filename: &str, flags: i32) -> Result<bool>

Opens a file. Read more
Source§

fn release(&mut self) -> Result<()>

Closes the file and releases all the memory buffers. Read more
Source§

fn release_and_get_string(&mut self) -> Result<String>

Closes the file and releases all the memory buffers. Read more
Source§

fn write_i32(&mut self, name: &str, val: i32) -> Result<()>

Simplified writing API to use with bindings. Read more
Source§

fn write(&mut self, name: &str, val: i64) -> Result<()>

Simplified writing API to use with bindings. Read more
Source§

fn write_f64(&mut self, name: &str, val: f64) -> Result<()>

Simplified writing API to use with bindings. Read more
Source§

fn write_str(&mut self, name: &str, val: &str) -> Result<()>

Simplified writing API to use with bindings. Read more
Source§

fn write_mat(&mut self, name: &str, val: &impl MatTraitConst) -> Result<()>

Simplified writing API to use with bindings. Read more
Source§

fn write_str_vec(&mut self, name: &str, val: &Vector<String>) -> Result<()>

Simplified writing API to use with bindings. Read more
Source§

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

Writes multiple numbers. Read more
Source§

fn write_comment(&mut self, comment: &str, append: bool) -> Result<()>

Writes a comment. Read more
Source§

fn write_comment_def(&mut self, comment: &str) -> Result<()>

Writes a comment. Read more
Source§

fn start_write_struct( &mut self, name: &str, flags: i32, type_name: &str, ) -> Result<()>

Starts to write a nested structure (sequence or a mapping). Read more
Source§

fn start_write_struct_def(&mut self, name: &str, flags: i32) -> Result<()>

Starts to write a nested structure (sequence or a mapping). Read more
Source§

fn end_write_struct(&mut self) -> Result<()>

Finishes writing nested structure (should pair startWriteStruct())
Source§

impl FileStorageTraitConst for FileStorage

Source§

fn as_raw_FileStorage(&self) -> *const c_void

Source§

fn state(&self) -> i32

Source§

fn elname(&self) -> String

Source§

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

Checks whether the file is opened. Read more
Source§

fn get_first_top_level_node(&self) -> Result<FileNode>

Returns the first element of the top-level mapping. Read more
Source§

fn root(&self, streamidx: i32) -> Result<FileNode>

Returns the top-level mapping Read more
Source§

fn root_def(&self) -> Result<FileNode>

Returns the top-level mapping Read more
Source§

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

Returns the specified element of the top-level mapping. Read more
Source§

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

Returns the specified element of the top-level mapping. Read more
Source§

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

Returns the current format. Read more
Source§

impl Send for FileStorage

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