Skip to main content

EntryMut

Struct EntryMut 

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

A mutable reference to an Entry. Implements DerefMut to &mut Entry.

Implementations§

Source§

impl EntryMut<'_>

Source

pub fn as_ref(&self) -> EntryRef<'_>

Get an immutable reference to the entry.

Source

pub fn edit(&mut self, f: impl FnOnce(&mut EntryMut<'_>)) -> &mut Self

Convenience method to edit the entry in a closure.

Source

pub fn edit_tracking( &mut self, f: impl FnOnce(&mut EntryTrack<'_>), ) -> &mut Self

Convenience method to edit the entry in a closure, tracking changes.

Source

pub fn track_changes(&mut self) -> EntryTrack<'_>

Convert this mutable reference into a history-tracking variant that will persist the current state of the entry into its history when dropped.

NOTE: will always operate on the main Entry, not a historical version of it.

Source

pub fn parent_mut(&mut self) -> GroupMut<'_>

Get a mutable reference to the parent group of this entry.

Source

pub fn previous_parent_mut(&mut self) -> Option<GroupMut<'_>>

Get a mutable reference to the previous parent group, if any

Source

pub fn attachment_mut(&mut self, id: AttachmentId) -> Option<AttachmentMut<'_>>

Get a mutable reference to an attachment by id, if it exists.

Source

pub fn attachment_by_name_mut( &mut self, name: &str, ) -> Option<AttachmentMut<'_>>

Get a mutable reference to an attachment by name, if it exists.

Source

pub fn foreach_attachment_mut<F>(&mut self, f: F)
where F: FnMut(AttachmentMut<'_>),

Apply a closure to each attachment of this entry, with mutable access.

Source

pub fn add_attachment( &mut self, name: impl Into<String>, data: Value<Vec<u8>>, ) -> AttachmentMut<'_>

Add an attachment to this entry with the given name and data.

Source

pub fn remove_attachment_by_name(&mut self, name: &str)

Remove an attachment by name from this entry.

If it was the last reference to the attachment, remove it from the database.

Source

pub fn remove_attachment_by_id(&mut self, attachment_id: AttachmentId)

Remove an attachment by id from this entry.

If it was the last reference to the attachment, remove it from the database.

Source

pub fn set_icon_none(&mut self)

Remove the icon from this entry, if it exists.

Source

pub fn set_icon_builtin(&mut self, icon_id: usize)

Set a built-in icon for this entry by its ID, removing any existing icon.

Source

pub fn set_icon_custom( &mut self, custom_icon_id: CustomIconId, ) -> Result<(), CustomIconNotFoundError>

Set a custom icon for this entry by its ID, removing any existing icon.

Source

pub fn set_icon_custom_new(&mut self, data: Vec<u8>) -> CustomIconMut<'_>

Set a custom icon for this entry by providing the raw data, removing any existing icon. Returns a mutable reference to the newly created custom icon.

Source

pub fn custom_icon_mut(&mut self) -> Option<CustomIconMut<'_>>

Get a mutable reference to the custom icon of this entry, if it exists and is a custom icon.

Source

pub fn move_to( &mut self, group_id: GroupId, ) -> Result<(), DestinationGroupNotFoundError>

Move this entry to another group.

NOTE: will always operate on the main Entry, not a historical version of it.

Source

pub fn database_mut(&mut self) -> &mut Database

Get a mutable reference to the underlying database

Source

pub fn remove(self)

Remove this entry from the database, including all its attachments.

Methods from Deref<Target = Entry>§

Source

pub fn id(&self) -> EntryId

Get the unique identifier for the Entry

Source

pub fn icon(&self) -> Option<&Icon>

Get the icon of this entry, if it exists

Source

pub fn get(&self, key: &str) -> Option<&str>

Get a field by name, taking care of unprotecting Protected values automatically

Source

pub fn set(&mut self, key: impl Into<String>, value: Value<String>)

Set a field’s value by name

Source

pub fn set_unprotected( &mut self, key: impl Into<String>, value: impl Into<String>, )

Set a field’s unprotected value by name

Source

pub fn set_protected( &mut self, key: impl Into<String>, value: impl Into<String>, )

Set a field’s protected value by name

Source

pub fn get_raw_otp_value(&self) -> Option<&str>

Convenience method for getting the raw value of the ‘otp’ field

Source

pub fn get_title(&self) -> Option<&str>

Convenience method for getting the value of the ‘Title’ field

Source

pub fn get_username(&self) -> Option<&str>

Convenience method for getting the value of the ‘UserName’ field

Source

pub fn get_password(&self) -> Option<&str>

Convenience method for getting the value of the ‘Password’ field

Source

pub fn get_url(&self) -> Option<&str>

Convenience method for getting the value of the ‘URL’ field

Trait Implementations§

Source§

impl Deref for EntryMut<'_>

Source§

type Target = Entry

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for EntryMut<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

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

§

impl<'a> Freeze for EntryMut<'a>

§

impl<'a> RefUnwindSafe for EntryMut<'a>

§

impl<'a> Send for EntryMut<'a>

§

impl<'a> Sync for EntryMut<'a>

§

impl<'a> Unpin for EntryMut<'a>

§

impl<'a> UnsafeUnpin for EntryMut<'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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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.