pub fn new(
        mut network: Box<dyn crate::VatNetwork<VatId>>,
        bootstrap: Option<::capnp::capability::Client>) -> RpcSystem<VatId>
    {
        let bootstrap_cap = match bootstrap {
            Some(cap) => cap.hook,
            None => broken::new_cap(Error::failed("no bootstrap capabiity".to_string())),
        };
        let (mut handle, tasks) = TaskSet::new(Box::new(SystemTaskReaper));

        let mut handle1 = handle.clone();
        handle.add(network.drive_until_shutdown().then(move |r| {
            let r = match r {
                Ok(()) => Ok(()),
                Err(e) => {
                    if e.kind != ::capnp::ErrorKind::Disconnected {
                        // Don't report disconnects as an error.
                        Err(e)
                    } else {
                        Ok(())
                    }
                }
            };

            handle1.terminate(r);
            Promise::ok(())
        }));

        let mut result = RpcSystem {
            network: network,
            bootstrap_cap: bootstrap_cap,
            connection_state: Rc::new(RefCell::new(None)),

            tasks: tasks,
            handle: handle.clone(),
        };


        let accept_loop = result.accept_loop();
        handle.add(accept_loop);
        result
    }
/// Constructs a new `RpcSystem` with the given network and bootstrap capability.
Constructs a new `RpcSystem` with the given network and bootstrap capability.
Constructs a new ` RpcSystem ` with the given network and bootstrap capability .
pub fn new(
        mut network: Box<dyn crate::VatNetwork<VatId>>,
        bootstrap: Option<::capnp::capability::Client>) -> RpcSystem<VatId>
    {
        let bootstrap_cap = match bootstrap {
            Some(cap) => cap.hook,
            None => broken::new_cap(Error::failed("no bootstrap capabiity".to_string())),
        };
        let (mut handle, tasks) = TaskSet::new(Box::new(SystemTaskReaper));
        let mut handle1 = handle.clone();
        handle.add(network.drive_until_shutdown().then(move |r| {
            let r = match r {
                Ok(()) => Ok(()),
                Err(e) => {
                    if e.kind != ::capnp::ErrorKind::Disconnected {
                        // Don't report disconnects as an error.
                        Err(e)
                    } else {
                        Ok(())
                    }
                }
            };
            handle1.terminate(r);
            Promise::ok(())
        }));
        let mut result = RpcSystem {
            network: network,
            bootstrap_cap: bootstrap_cap,
            connection_state: Rc::new(RefCell::new(None)),
            tasks: tasks,
            handle: handle.clone(),
        };
        let accept_loop = result.accept_loop();
        handle.add(accept_loop);
        result
    }
pub fn new ( mut network : Box < dyn crate :: VatNetwork < VatId > > , bootstrap : Option < :: capnp :: capability :: Client > ) -> RpcSystem < VatId > { let bootstrap_cap = match bootstrap { Some ( cap ) => cap . hook , None => broken :: new_cap ( Error :: failed ( " " . to_string ( ) ) ) , } ; let ( mut handle , tasks ) = TaskSet :: new ( Box :: new ( SystemTaskReaper ) ) ; let mut handle1 = handle . clone ( ) ; handle . add ( network . drive_until_shutdown ( ) . then ( move | r | { let r = match r { Ok ( ( ) ) => Ok ( ( ) ) , Err ( e ) => { if e . kind != :: capnp :: ErrorKind :: Disconnected { // Don't report disconnects as an error. Err ( e ) } else { Ok ( ( ) ) } } } ; handle1 . terminate ( r ) ; Promise :: ok ( ( ) ) } ) ) ; let mut result = RpcSystem { network : network , bootstrap_cap : bootstrap_cap , connection_state : Rc :: new ( RefCell :: new ( None ) ) , tasks : tasks , handle : handle . clone ( ) , } ; let accept_loop = result . accept_loop ( ) ; handle . add ( accept_loop ) ; result }
Constructs a new `RpcSystem` with the given network and bootstrap capability.
Constructs a new ` RpcSystem ` with the given network and bootstrap capability .
network
Box<dyn crate::VatNetwork<VatId>>
bootstrap
Option<::capnp::capability::Client>
network
Box<dyn crate::VatNetwork<VatId>>
bootstrap
Option<::capnp::capability::Client>