From fac21b5541f9d8cb300b87deb66379516f2ab679 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Fri, 17 Nov 2023 10:38:20 +0100 Subject: [PATCH] refactor: Rename sequences --- src/clientv2/session.rs | 4 ++-- src/http/sequence.rs | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/clientv2/session.rs b/src/clientv2/session.rs index 3c2176c..132c38d 100644 --- a/src/clientv2/session.rs +++ b/src/clientv2/session.rs @@ -6,7 +6,7 @@ use crate::domain::{ use crate::http; use crate::http::{ ClientAsync, ClientRequest, ClientRequestBuilder, ClientSync, FromResponse, Request, - RequestDesc, Sequence, StateProducerSequence, X_PM_UID_HEADER, + RequestDesc, Sequence, SequenceFromState, X_PM_UID_HEADER, }; use crate::requests::{ AuthInfoRequest, AuthInfoResponse, AuthRefreshRequest, AuthRequest, AuthResponse, @@ -84,7 +84,7 @@ impl Session { hv: human_verification, }; - StateProducerSequence::new(state, login_sequence_1) + SequenceFromState::new(state, login_sequence_1) } pub fn submit_totp(&self, code: &str) -> impl Sequence { diff --git a/src/http/sequence.rs b/src/http/sequence.rs index 321fd66..5df24d2 100644 --- a/src/http/sequence.rs +++ b/src/http/sequence.rs @@ -38,14 +38,14 @@ pub trait Sequence { MapSequence { c: self, f } } - fn state(self, f: F) -> StateSequence + fn state(self, f: F) -> SequenceWithState where Self: Sized, SS: Sequence, F: FnOnce(Self::Output) -> SS, ::Error: From + From + Debug, { - StateSequence { seq: self, f } + SequenceWithState { seq: self, f } } fn chain(self, f: F) -> SequenceChain @@ -150,12 +150,12 @@ where } #[doc(hidden)] -pub struct StateSequence { +pub struct SequenceWithState { seq: S, f: F, } -impl Sequence for StateSequence +impl Sequence for SequenceWithState where S: Sequence, SS: Sequence, @@ -192,8 +192,8 @@ where client: &'a T, ) -> impl Future< Output = Result< - as Sequence>::Output, - as Sequence>::Error, + as Sequence>::Output, + as Sequence>::Error, >, > + 'a where @@ -209,18 +209,18 @@ where } #[doc(hidden)] -pub struct StateProducerSequence { +pub struct SequenceFromState { s: S, f: F, } -impl StateProducerSequence { +impl SequenceFromState { pub fn new(s: S, f: F) -> Self { Self { s, f } } } -impl Sequence for StateProducerSequence +impl Sequence for SequenceFromState where Seq: Sequence, F: FnOnce(S) -> Seq, @@ -253,8 +253,8 @@ where client: &'a T, ) -> impl Future< Output = Result< - as Sequence>::Output, - as Sequence>::Error, + as Sequence>::Output, + as Sequence>::Error, >, > + 'a where