@@ -29,22 +29,33 @@ pub enum CompatSessionState {
2929}
3030
3131impl CompatSessionState {
32- /// Returns `true` if the compta session state is [`Valid`].
32+ /// Returns `true` if the compat session state is [`Valid`].
3333 ///
3434 /// [`Valid`]: CompatSessionState::Valid
3535 #[ must_use]
3636 pub fn is_valid ( & self ) -> bool {
3737 matches ! ( self , Self :: Valid )
3838 }
3939
40- /// Returns `true` if the compta session state is [`Finished`].
40+ /// Returns `true` if the compat session state is [`Finished`].
4141 ///
4242 /// [`Finished`]: CompatSessionState::Finished
4343 #[ must_use]
4444 pub fn is_finished ( & self ) -> bool {
4545 matches ! ( self , Self :: Finished { .. } )
4646 }
4747
48+ /// Transitions the session state to [`Finished`].
49+ ///
50+ /// # Parameters
51+ ///
52+ /// * `finished_at` - The time at which the session was finished.
53+ ///
54+ /// # Errors
55+ ///
56+ /// Returns an error if the session state is already [`Finished`].
57+ ///
58+ /// [`Finished`]: CompatSessionState::Finished
4859 pub fn finish ( self , finished_at : DateTime < Utc > ) -> Result < Self , InvalidTransitionError > {
4960 match self {
5061 Self :: Valid => Ok ( Self :: Finished { finished_at } ) ,
@@ -80,6 +91,15 @@ impl std::ops::Deref for CompatSession {
8091}
8192
8293impl CompatSession {
94+ /// Marks the session as finished.
95+ ///
96+ /// # Parameters
97+ ///
98+ /// * `finished_at` - The time at which the session was finished.
99+ ///
100+ /// # Errors
101+ ///
102+ /// Returns an error if the session is already finished.
83103 pub fn finish ( mut self , finished_at : DateTime < Utc > ) -> Result < Self , InvalidTransitionError > {
84104 self . state = self . state . finish ( finished_at) ?;
85105 Ok ( self )
0 commit comments