FileEditFile

Struct FileEditFile 

Source
pub struct FileEditFile<'a> { /* private fields */ }
Expand description

File file editor.

Implementations§

Source§

impl<'a> FileEditFile<'a>

Source

pub fn descriptor(&self) -> &Descriptor

Gets the file descriptor as-is.

Source

pub fn set_content( &mut self, content_type: u32, content_size: u32, ) -> &mut FileEditFile<'a>

Sets the content type and size for this file descriptor.

Note that a content type of 0 gets overwritten by a type of 1.

Source

pub fn set_section(&mut self, section: &Section) -> &mut FileEditFile<'a>

Assigns an existing section object to this file descriptor.

This can be used to make different descriptors point to the same data.

Source

pub fn allocate_data(&mut self) -> &mut FileEditFile<'a>

Allocates and assigns space for the data.

The size allocated is defined by a previous call to set_content’s content_size argument.

The space allocated is logically uninitialized and must be initialized with write_data or zero_data.

Source

pub fn write_data( &mut self, data: &[u8], key: &Key, ) -> Result<&mut FileEditFile<'a>>

Copies and encrypts the data with the given key into the address specified by this file descriptor.

Source

pub fn zero_data(&mut self, key: &Key) -> Result<&mut FileEditFile<'a>>

Initialize the data with zeroes.

Source

pub fn reencrypt_data(&mut self, old_key: &Key, key: &Key) -> Result<()>

Reencrypts the data.

The file must be initialized (either through init_data or zero_data) before it can be updated.

§Consistency guarantees

The file contents are updated inplace. In the case of a failure (forced crash or power loss) the consistency is not guaranteed.

If consistency is important, consider removing & creating the file again instead.

Auto Trait Implementations§

§

impl<'a> Freeze for FileEditFile<'a>

§

impl<'a> RefUnwindSafe for FileEditFile<'a>

§

impl<'a> Send for FileEditFile<'a>

§

impl<'a> Sync for FileEditFile<'a>

§

impl<'a> Unpin for FileEditFile<'a>

§

impl<'a> !UnwindSafe for FileEditFile<'a>

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