pub struct PendingClientCtx(/* private fields */);Expand description
a partly initialized client context
Implementations§
Source§impl PendingClientCtx
impl PendingClientCtx
Sourcepub fn step(
self,
token: &[u8],
) -> Result<Step<(ClientCtx, Option<impl Deref<Target = [u8]>>), (PendingClientCtx, impl Deref<Target = [u8]>)>>
pub fn step( self, token: &[u8], ) -> Result<Step<(ClientCtx, Option<impl Deref<Target = [u8]>>), (PendingClientCtx, impl Deref<Target = [u8]>)>>
Feed the server provided token to the client context, performing one step of the initialization. If the initialization is complete then return the established context and optionally a final token that must be sent to the server, otherwise return the pending context and another token to pass to the server.
Examples found in repository?
examples/auth.rs (line 61)
52fn client(spn: &str, input: mpsc::Receiver<Msg>, output: mpsc::Sender<Msg>) {
53 let (mut client, token) =
54 ClientCtx::new(InitiateFlags::empty(), None, spn, None).expect("new");
55 output.send(Msg::Token(Bytes::copy_from_slice(&*token))).expect("send");
56 let mut client = loop {
57 let token = match input.recv().expect("expected data") {
58 Msg::Msg(_) => panic!("client not finished initializing"),
59 Msg::Token(t) => t,
60 };
61 match client.step(&*token).expect("step") {
62 Step::Finished((ctx, token)) => {
63 if let Some(token) = token {
64 output
65 .send(Msg::Token(Bytes::copy_from_slice(&*token)))
66 .expect("send");
67 }
68 break ctx;
69 }
70 Step::Continue((ctx, token)) => {
71 output.send(Msg::Token(Bytes::copy_from_slice(&*token))).expect("send");
72 client = ctx;
73 }
74 }
75 };
76 let msg = client.wrap(true, b"super secret message").expect("wrap");
77 output.send(Msg::Msg(Bytes::copy_from_slice(&*msg))).expect("send");
78}Auto Trait Implementations§
impl Freeze for PendingClientCtx
impl RefUnwindSafe for PendingClientCtx
impl Send for PendingClientCtx
impl !Sync for PendingClientCtx
impl Unpin for PendingClientCtx
impl UnsafeUnpin for PendingClientCtx
impl UnwindSafe for PendingClientCtx
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