PayeeService

Struct PayeeService 

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

Service for payee management

Implementations§

Source§

impl<'a> PayeeService<'a>

Source

pub fn new(storage: &'a Storage) -> Self

Create a new payee service

Source

pub fn create(&self, name: &str) -> EnvelopeResult<Payee>

Create a new payee

Source

pub fn create_with_category( &self, name: &str, category_id: CategoryId, ) -> EnvelopeResult<Payee>

Create a payee with a default category

Source

pub fn get(&self, id: PayeeId) -> EnvelopeResult<Option<Payee>>

Get a payee by ID

Source

pub fn get_by_name(&self, name: &str) -> EnvelopeResult<Option<Payee>>

Get a payee by name (case-insensitive)

Source

pub fn find(&self, identifier: &str) -> EnvelopeResult<Option<Payee>>

Find a payee by ID or name

Source

pub fn get_or_create(&self, name: &str) -> EnvelopeResult<Payee>

Get or create a payee by name

Source

pub fn list(&self) -> EnvelopeResult<Vec<Payee>>

List all payees

Source

pub fn search(&self, query: &str, limit: usize) -> EnvelopeResult<Vec<Payee>>

Search payees by name (fuzzy match)

Source

pub fn suggest(&self, partial: &str) -> EnvelopeResult<Vec<Payee>>

Suggest payees matching a partial name

Source

pub fn get_suggested_category( &self, payee_name: &str, ) -> EnvelopeResult<Option<CategoryId>>

Get the suggested category for a payee

Source

pub fn set_default_category( &self, id: PayeeId, category_id: CategoryId, ) -> EnvelopeResult<Payee>

Set the default category for a payee

Source

pub fn clear_default_category(&self, id: PayeeId) -> EnvelopeResult<Payee>

Clear the default category for a payee

Source

pub fn record_category_usage( &self, payee_id: PayeeId, category_id: CategoryId, ) -> EnvelopeResult<()>

Record a category usage for a payee (for learning)

Source

pub fn delete(&self, id: PayeeId) -> EnvelopeResult<Payee>

Delete a payee

Source

pub fn rename(&self, id: PayeeId, new_name: &str) -> EnvelopeResult<Payee>

Rename a payee

Source

pub fn count(&self) -> EnvelopeResult<usize>

Count payees

Auto Trait Implementations§

§

impl<'a> Freeze for PayeeService<'a>

§

impl<'a> RefUnwindSafe for PayeeService<'a>

§

impl<'a> Send for PayeeService<'a>

§

impl<'a> Sync for PayeeService<'a>

§

impl<'a> Unpin for PayeeService<'a>

§

impl<'a> UnwindSafe for PayeeService<'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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = 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.