pub struct Session {
pub id: Option<i64>,
pub project_id: i64,
pub start_time: DateTime<Utc>,
pub end_time: Option<DateTime<Utc>>,
pub context: SessionContext,
pub paused_duration: Duration,
pub notes: Option<String>,
pub created_at: DateTime<Utc>,
}Fields§
§id: Option<i64>§project_id: i64§start_time: DateTime<Utc>§end_time: Option<DateTime<Utc>>§context: SessionContext§paused_duration: Duration§notes: Option<String>§created_at: DateTime<Utc>Implementations§
Source§impl Session
impl Session
pub fn new(project_id: i64, context: SessionContext) -> Self
pub fn with_start_time(self, start_time: DateTime<Utc>) -> Self
pub fn with_notes(self, notes: Option<String>) -> Self
pub fn end_session(&mut self) -> Result<()>
pub fn add_pause_duration(&mut self, duration: Duration)
pub fn is_active(&self) -> bool
pub fn status(&self) -> SessionStatus
pub fn total_duration(&self) -> Option<Duration>
pub fn active_duration(&self) -> Option<Duration>
pub fn current_duration(&self) -> Duration
pub fn current_active_duration(&self) -> Duration
pub fn validate(&self) -> Result<()>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Session
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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<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