Struct keepass_ng::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 add_child(&mut self, child: NodePtr, index: usize)

source

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

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

use keepass::{
    db::{Entry, Group},
    Database, 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();

if let Some(e) = Group::get(&db.root, &["General", "Sample Entry #2"]) {
    if let Some(e) = e.borrow().as_any().downcast_ref::<Entry>() {
        println!("User: {}", e.get_username().unwrap());
    }
}
source

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

source

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

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 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() -> Self

Returns the “default value” for a type. Read more
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

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

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 Eq for Group

Auto Trait Implementations§

§

impl Freeze for Group

§

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn type_name(&self) -> &'static str

Gets the type name of self
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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Downcast for T
where T: AsAny + ?Sized,

source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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.