Struct hua_core::user::UserManager
source · [−]pub struct UserManager { /* private fields */ }
Expand description
Manages all users.
Implementations
sourceimpl UserManager
impl UserManager
sourcepub fn init<P: AsRef<Path>>(path: P) -> Result<Self, UserError>
pub fn init<P: AsRef<Path>>(path: P) -> Result<Self, UserError>
Create a new user manager under the given path. Returns an error if the path is already present.
sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self, UserError>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, UserError>
Opens an old user manager under the given path.
pub fn current_generation_index(&self) -> usize
sourcepub fn insert_requirement<B: ReadBackend<Source = PathBuf>>(
&mut self,
requirement: Requirement,
store: &Store<PathBuf, B>,
global_paths: &ComponentPathBuf
) -> Result<bool, UserError>
pub fn insert_requirement<B: ReadBackend<Source = PathBuf>>(
&mut self,
requirement: Requirement,
store: &Store<PathBuf, B>,
global_paths: &ComponentPathBuf
) -> Result<bool, UserError>
Inserts a requiremnt into the current user. If the requirement was not fullfilled, a try to get a matching package from the store is started. If the package could be retrieved a new generation is created and true is returned. If it fullfilled false is returned
sourcepub fn remove_requirement<B: ReadBackend<Source = PathBuf>>(
&mut self,
requirement: &Requirement,
store: &Store<PathBuf, B>,
global_paths: &ComponentPathBuf
) -> Result<bool, UserError>
pub fn remove_requirement<B: ReadBackend<Source = PathBuf>>(
&mut self,
requirement: &Requirement,
store: &Store<PathBuf, B>,
global_paths: &ComponentPathBuf
) -> Result<bool, UserError>
Remove a package from the current user. If the package was present return true and create a new generation without the package. If it was not present false is returned.
pub fn filter_requirements<'a, P>(
&'a self,
predicate: P
) -> impl Iterator<Item = &'a Requirement> where
P: Fn(&Requirement) -> bool + 'a,
pub fn filter_requirements_by_name_starting_with<'a>(
&'a self,
name: &'a str
) -> impl Iterator<Item = &'a Requirement>
pub fn filter_requirements_by_name_containing<'a>(
&'a self,
name: &'a str
) -> impl Iterator<Item = &'a Requirement>
sourcepub fn remove_generation(&mut self, id: usize) -> Result<bool, UserError>
pub fn remove_generation(&mut self, id: usize) -> Result<bool, UserError>
Removes the specified generation. Returns true if the generation was present and false if it wasnt.
pub fn switch_generation(
&mut self,
id: usize,
global_paths: &ComponentPathBuf
) -> Result<(), UserError>
sourcepub fn list_current_packages(&self)
pub fn list_current_packages(&self)
Lists all packages in the current generation.
sourcepub fn list_current_generations(&self)
pub fn list_current_generations(&self)
Lists all generations
pub fn packages(&self) -> impl Iterator<Item = &PackageId>
Auto Trait Implementations
impl RefUnwindSafe for UserManager
impl Send for UserManager
impl Sync for UserManager
impl Unpin for UserManager
impl UnwindSafe for UserManager
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more