pub struct InstantServer { /* private fields */ }Implementations§
Source§impl InstantServer
impl InstantServer
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/protocol_greetings_with_instant_server.rs (line 41)
38async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
39 let ir = InstantRegistry::new();
40 // The instant server will automatically use the instant registry when there is one.
41 let is0 = InstantServer::new();
42 let is1 = InstantServer::new();
43 let cl0 = is0.get_colink().switch_to_generated_user().await?;
44 let cl1 = is1.get_colink().switch_to_generated_user().await?;
45 colink::protocol_attach!(
46 cl0,
47 ("greetings:initiator", Initiator),
48 ("greetings:receiver", Receiver)
49 );
50 colink::protocol_attach!(
51 cl1,
52 ("greetings:initiator", Initiator),
53 ("greetings:receiver", Receiver)
54 );
55 let participants = vec![
56 Participant {
57 user_id: cl0.get_user_id()?,
58 role: "initiator".to_string(),
59 },
60 Participant {
61 user_id: cl1.get_user_id()?,
62 role: "receiver".to_string(),
63 },
64 ];
65 let task_id = cl0
66 .run_task("greetings", "test".as_bytes(), &participants, true)
67 .await?;
68 let res = cl1
69 .read_or_wait(&format!("tasks:{}:output", task_id))
70 .await?;
71 println!("{}", String::from_utf8_lossy(&res));
72 Ok(())
73}pub fn new_with_config(user_init_config: &str) -> Self
Sourcepub fn get_colink(&self) -> CoLink
pub fn get_colink(&self) -> CoLink
Examples found in repository?
examples/protocol_greetings_with_instant_server.rs (line 43)
38async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
39 let ir = InstantRegistry::new();
40 // The instant server will automatically use the instant registry when there is one.
41 let is0 = InstantServer::new();
42 let is1 = InstantServer::new();
43 let cl0 = is0.get_colink().switch_to_generated_user().await?;
44 let cl1 = is1.get_colink().switch_to_generated_user().await?;
45 colink::protocol_attach!(
46 cl0,
47 ("greetings:initiator", Initiator),
48 ("greetings:receiver", Receiver)
49 );
50 colink::protocol_attach!(
51 cl1,
52 ("greetings:initiator", Initiator),
53 ("greetings:receiver", Receiver)
54 );
55 let participants = vec![
56 Participant {
57 user_id: cl0.get_user_id()?,
58 role: "initiator".to_string(),
59 },
60 Participant {
61 user_id: cl1.get_user_id()?,
62 role: "receiver".to_string(),
63 },
64 ];
65 let task_id = cl0
66 .run_task("greetings", "test".as_bytes(), &participants, true)
67 .await?;
68 let res = cl1
69 .read_or_wait(&format!("tasks:{}:output", task_id))
70 .await?;
71 println!("{}", String::from_utf8_lossy(&res));
72 Ok(())
73}Trait Implementations§
Source§impl Default for InstantServer
impl Default for InstantServer
Auto Trait Implementations§
impl Freeze for InstantServer
impl RefUnwindSafe for InstantServer
impl Send for InstantServer
impl Sync for InstantServer
impl Unpin for InstantServer
impl UnwindSafe for InstantServer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request