Struct kpdb::Group

source ·
pub struct Group {
Show 20 fields pub creation_time: DateTime<Utc>, pub custom_icon_uuid: Option<CustomIconUuid>, pub def_auto_type_sequence: String, pub enable_auto_type: Option<bool>, pub enable_searching: Option<bool>, pub entries: Vec<Entry>, pub expires: bool, pub expiry_time: DateTime<Utc>, pub groups: Vec<Group>, pub icon: Icon, pub is_expanded: bool, pub last_accessed: DateTime<Utc>, pub last_modified: DateTime<Utc>, pub last_top_visible_entry: EntryUuid, pub location_changed: DateTime<Utc>, pub name: String, pub notes: String, pub usage_count: i32, pub uuid: GroupUuid, pub parent: GroupUuid,
}
Expand description

A group in the database.

Fields§

§creation_time: DateTime<Utc>

The date and time this group was created.

§custom_icon_uuid: Option<CustomIconUuid>

The identifier of this group’s custom icon if any.

§def_auto_type_sequence: String

Default auto-type sequence.

§enable_auto_type: Option<bool>

Whether auto-type is enabled.

§enable_searching: Option<bool>

Whether searching is enabled.

§entries: Vec<Entry>

Vector with entries that belong to this group.

§expires: bool

Whether this group expires.

§expiry_time: DateTime<Utc>

The date and time this group will expire if expires is true.

§groups: Vec<Group>

Vector with subgroups of this group.

§icon: Icon

This group’s icon.

§is_expanded: bool

Whether this group is expanded.

§last_accessed: DateTime<Utc>

The date and time this group was last accessed.

§last_modified: DateTime<Utc>

The date and time this group was last modified.

§last_top_visible_entry: EntryUuid

The identifier of the last top visible entry.

§location_changed: DateTime<Utc>

The date and time the location of this group was changed.

§name: String

The name of this group.

§notes: String

The notes of this group.

§usage_count: i32

The usage count of this group.

§uuid: GroupUuid

The identifier of this group.

§parent: GroupUuid

The parent groups GroupUUID.

Implementations§

source§

impl Group

source

pub fn new<S: Into<String>>(name: S) -> Group

Create a new group.

Examples
use kpdb::Group;

let group = Group::new("Websites");
source

pub fn add_entry(&mut self, entry: Entry)

Add an entry to the current group.

Examples
use kpdb::{Entry, Group};

let mut group = Group::new("group");
let entry = Entry::new();

assert_eq!(group.entries.len(), 0);
group.add_entry(entry.clone());
assert_eq!(group.entries.len(), 1);
assert_eq!(group.entries[0], entry);
source

pub fn add_group(&mut self, group: Group)

Add a sub group to the current group.

Examples
use kpdb::Group;

let mut root = Group::new("root");
let child = Group::new("child");

assert_eq!(root.groups.len(), 0);
root.add_group(child.clone());
assert_eq!(root.groups.len(), 1);
assert_eq!(root.groups[0], child);
source

pub fn iter(&self) -> Iter<'_>

Returns an iterator over the group and sub groups.

Examples
use kpdb::Group;

let mut root = Group::new("root");
let sub_1 = Group::new("sub_1");
let sub_2 = Group::new("sub_2");
root.add_group(sub_1.clone());
root.add_group(sub_2.clone());

let mut iterator = root.iter();
assert_eq!(iterator.next(), Some(&root));
assert_eq!(iterator.next(), Some(&sub_1));
assert_eq!(iterator.next(), Some(&sub_2));
assert_eq!(iterator.next(), None);
source

pub fn iter_mut(&mut self) -> IterMut<'_>

Returns an iterator that allows modifying each group.

Examples
use kpdb::Group;

let mut root = Group::new("root");
for group in root.iter_mut() {
    group.name = String::from("name");
}
assert_eq!(root.name, "name");
source

pub fn remove_entry(&mut self, entry_uuid: EntryUuid) -> Option<Entry>

Remove an entry from the current group.

Examples
use kpdb::{Entry, Group};

let mut group = Group::new("Sample");
let entry = Entry::new();
group.add_entry(entry.clone());
assert_eq!(group.entries.len(), 1);
assert_eq!(group.remove_entry(entry.uuid), Some(entry));
assert_eq!(group.entries.len(), 0);
source

pub fn remove_group(&mut self, group_uuid: GroupUuid) -> Option<Group>

Remove a sub group from the current group.

Examples
use kpdb::Group;

let mut parent = Group::new("Parent");
let child = Group::new("Child");
parent.add_group(child.clone());
assert_eq!(parent.groups.len(), 1);
assert_eq!(parent.remove_group(child.uuid), Some(child));
assert_eq!(parent.groups.len(), 0);

Trait Implementations§

source§

impl Clone for Group

source§

fn clone(&self) -> Group

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 Group

source§

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

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

impl Default for Group

source§

fn default() -> Group

Returns the “default value” for a type. Read more
source§

impl PartialEq<Group> for Group

source§

fn eq(&self, other: &Group) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Times for Group

source§

fn creation_time(&self) -> DateTime<Utc>

Gets the date and time the implementor was created.
source§

fn expires(&self) -> bool

Gets whether the implementor expires.
source§

fn expiry_time(&self) -> DateTime<Utc>

Gets the date and time the implementor will expire if expires is true.
source§

fn last_accessed(&self) -> DateTime<Utc>

Gets the date and time the implementor was last accessed.
source§

fn last_modified(&self) -> DateTime<Utc>

Gets the date and time the implementor was last modified.
source§

fn location_changed(&self) -> DateTime<Utc>

Gets the date and time the location of the implementor was changed.
source§

fn usage_count(&self) -> i32

Gets the usage count for the implementor.
source§

fn set_creation_time(&mut self, val: DateTime<Utc>)

Sets the date and time the implementor was created.
source§

fn set_expires(&mut self, val: bool)

Sets whether the implementor expires.
source§

fn set_expiry_time(&mut self, val: DateTime<Utc>)

Sets the date and time the implementor will expire if expires is true.
source§

fn set_last_accessed(&mut self, val: DateTime<Utc>)

Sets the date and time the implementor was last accessed.
source§

fn set_last_modified(&mut self, val: DateTime<Utc>)

Sets the date and time the implementor was last modified.
source§

fn set_location_changed(&mut self, val: DateTime<Utc>)

Sets the date and time the location of the implementor was changed.
source§

fn set_usage_count(&mut self, val: i32)

Sets the usage count for the implementor.
source§

impl StructuralPartialEq for Group

Auto Trait Implementations§

§

impl RefUnwindSafe for Group

§

impl Send for Group

§

impl Sync for Group

§

impl Unpin for Group

§

impl UnwindSafe for Group

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere 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 Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V