pub struct Retention { /* private fields */ }Expand description
Retention policy configuration for email messages.
A retention policy defines how old messages should be before they are subject to retention actions (trash/delete), and whether a label should be automatically generated to categorize messages matching this policy.
§Examples
use cull_gmail::{Retention, MessageAge};
// Create a retention policy for messages older than 6 months
let policy = Retention::new(MessageAge::Months(6), true);
// Create a retention policy without auto-generated labels
let policy = Retention::new(MessageAge::Years(1), false);Implementations§
Source§impl Retention
impl Retention
Sourcepub fn new(age: MessageAge, generate_label: bool) -> Self
pub fn new(age: MessageAge, generate_label: bool) -> Self
Create a new retention policy.
§Arguments
age- The message age threshold for this retention policygenerate_label- Whether to automatically generate a label for messages matching this policy
§Examples
use cull_gmail::{Retention, MessageAge};
// Policy for messages older than 30 days with auto-generated label
let policy = Retention::new(MessageAge::Days(30), true);
// Policy for messages older than 1 year without label generation
let policy = Retention::new(MessageAge::Years(1), false);Sourcepub fn age(&self) -> &MessageAge
pub fn age(&self) -> &MessageAge
Get the message age threshold for this retention policy.
§Examples
use cull_gmail::{Retention, MessageAge};
let policy = Retention::new(MessageAge::Days(30), true);
assert_eq!(policy.age(), &MessageAge::Days(30));Sourcepub fn generate_label(&self) -> bool
pub fn generate_label(&self) -> bool
Check if this retention policy should generate automatic labels.
When true, messages matching this retention policy will be automatically
tagged with a generated label based on the age specification.
§Examples
use cull_gmail::{Retention, MessageAge};
let policy = Retention::new(MessageAge::Days(30), true);
assert_eq!(policy.generate_label(), true);
let policy = Retention::new(MessageAge::Days(30), false);
assert_eq!(policy.generate_label(), false);Sourcepub fn set_generate_label(&mut self, generate_label: bool)
pub fn set_generate_label(&mut self, generate_label: bool)
Set whether this retention policy should generate automatic labels.
§Examples
use cull_gmail::{Retention, MessageAge};
let mut policy = Retention::new(MessageAge::Days(30), false);
policy.set_generate_label(true);
assert_eq!(policy.generate_label(), true);Trait Implementations§
impl Eq for Retention
impl StructuralPartialEq for Retention
Auto Trait Implementations§
impl Freeze for Retention
impl RefUnwindSafe for Retention
impl Send for Retention
impl Sync for Retention
impl Unpin for Retention
impl UnwindSafe for Retention
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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