Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
refactor: Rename sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
Leander Beernaert committed Nov 17, 2023
1 parent f2dd9b6 commit fac21b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/clientv2/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Output = (), Error = http::Error> {
Expand Down
22 changes: 11 additions & 11 deletions src/http/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ pub trait Sequence {
MapSequence { c: self, f }
}

fn state<SS, F>(self, f: F) -> StateSequence<Self, F>
fn state<SS, F>(self, f: F) -> SequenceWithState<Self, F>
where
Self: Sized,
SS: Sequence,
F: FnOnce(Self::Output) -> SS,
<SS as Sequence>::Error: From<Self::Error> + From<Error> + Debug,
{
StateSequence { seq: self, f }
SequenceWithState { seq: self, f }
}

fn chain<SS, E, F>(self, f: F) -> SequenceChain<Self, F>
Expand Down Expand Up @@ -150,12 +150,12 @@ where
}

#[doc(hidden)]
pub struct StateSequence<S, F> {
pub struct SequenceWithState<S, F> {
seq: S,
f: F,
}

impl<S, SS, F> Sequence for StateSequence<S, F>
impl<S, SS, F> Sequence for SequenceWithState<S, F>
where
S: Sequence,
SS: Sequence,
Expand Down Expand Up @@ -192,8 +192,8 @@ where
client: &'a T,
) -> impl Future<
Output = Result<
<StateSequence<S, F> as Sequence>::Output,
<StateSequence<S, F> as Sequence>::Error,
<SequenceWithState<S, F> as Sequence>::Output,
<SequenceWithState<S, F> as Sequence>::Error,
>,
> + 'a
where
Expand All @@ -209,18 +209,18 @@ where
}

#[doc(hidden)]
pub struct StateProducerSequence<S, F> {
pub struct SequenceFromState<S, F> {
s: S,
f: F,
}

impl<S, F> StateProducerSequence<S, F> {
impl<S, F> SequenceFromState<S, F> {
pub fn new(s: S, f: F) -> Self {
Self { s, f }
}
}

impl<Seq, S, F> Sequence for StateProducerSequence<S, F>
impl<Seq, S, F> Sequence for SequenceFromState<S, F>
where
Seq: Sequence,
F: FnOnce(S) -> Seq,
Expand Down Expand Up @@ -253,8 +253,8 @@ where
client: &'a T,
) -> impl Future<
Output = Result<
<StateProducerSequence<S, F> as Sequence>::Output,
<StateProducerSequence<S, F> as Sequence>::Error,
<SequenceFromState<S, F> as Sequence>::Output,
<SequenceFromState<S, F> as Sequence>::Error,
>,
> + 'a
where
Expand Down

0 comments on commit fac21b5

Please sign in to comment.