Skip to main content

Group

Struct Group 

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

A database group with child groups and entries

Implementations§

Source§

impl Group

Source

pub fn new(name: &str) -> Group

Source

pub fn get_children(&self) -> Vec<NodePtr>

Source

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

Source

pub fn tags(&self) -> &[String]

Source

pub fn get_tags_mut(&mut self) -> &mut Vec<String>

Source

pub fn custom_data(&self) -> &HashMap<String, CustomDataItem>

Source

pub fn custom_data_mut(&mut self) -> &mut HashMap<String, CustomDataItem>

Source

pub fn previous_parent_group(&self) -> Option<Uuid>

Source

pub fn add_child(&mut self, child: NodePtr, index: usize)

Source

pub fn get(group: &NodePtr, path: &[&str]) -> Option<NodePtr>

Recursively get a Group or Entry reference by specifying a path relative to the current Group

use keepass_ng::{
    db::{with_node, Database, Entry, Group},
    DatabaseKey,
};
use std::fs::File;

let mut file = File::open("tests/resources/test_db_with_password.kdbx").unwrap();
let db = Database::open(&mut file, DatabaseKey::new().with_password("demopass")).unwrap();

let e = Group::get(&db.root, &["General", "Sample Entry #2"]).unwrap();
with_node::<Entry, _, _>(&e, |e| {
    println!("User: {}", e.get_username().unwrap());
});
Source

pub fn get_by_uuid<T: AsRef<str>>( group: &NodePtr, path: &[T], ) -> Option<NodePtr>

Source

pub fn entries(&self) -> Vec<NodePtr>

Source

pub fn groups(&self) -> Vec<NodePtr>

Source

pub fn reset_children(&mut self, children: Vec<NodePtr>)

Source§

impl Group

Source

pub fn merge(root: &NodePtr, other_group: &NodePtr) -> Result<MergeLog>

Merge this group with another group

Trait Implementations§

Source§

impl Clone for Group

Source§

fn clone(&self) -> Group

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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() -> Self

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

impl Eq for Group

Source§

impl Node for Group

Source§

fn duplicate(&self) -> NodePtr

Source§

fn get_uuid(&self) -> Uuid

Source§

fn set_uuid(&mut self, uuid: Uuid)

Source§

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

Source§

fn set_title(&mut self, title: Option<&str>)

Source§

fn get_notes(&self) -> Option<&str>

Source§

fn set_notes(&mut self, notes: Option<&str>)

Source§

fn get_icon_id(&self) -> Option<IconId>

Source§

fn set_icon_id(&mut self, icon_id: Option<IconId>)

Source§

fn get_custom_icon_uuid(&self) -> Option<Uuid>

Source§

fn get_times(&self) -> &Times

Get a timestamp field by name Read more
Source§

fn get_times_mut(&mut self) -> &mut Times

Source§

fn get_parent(&self) -> Option<Uuid>

Source§

fn set_parent(&mut self, parent: Option<Uuid>)

Source§

impl PartialEq for Group

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Group

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Group

§

impl !Send for Group

§

impl !Sync for Group

§

impl !UnwindSafe for Group

§

impl Freeze for Group

§

impl Unpin for Group

§

impl UnsafeUnpin for Group

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

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.