fn host_fn(&self) -> Box<Fn(ServerEnd<DirectoryMarker>) + Send + Sync> {
        let host_service = self.host_service;
        let host_directory = self.host_directory;
        Box::new(move |server_end: ServerEnd<DirectoryMarker>| {
            fasync::spawn(async move {
                let mut pseudo_dir = directory::simple::empty();
                if host_service {
                    pseudo_dir.add_entry("svc",
                            pseudo_directory! {
                                "foo" =>
                                    directory_broker::DirectoryBroker::new_service_broker(Box::new(echo_server_fn)),
                            })
                        .map_err(|(s,_)| s)
                        .expect("failed to add svc entry");
                }
                if host_directory {
                    pseudo_dir
                        .add_entry(
                            "data",
                            pseudo_directory! {
                                "foo" => pseudo_directory! {
                                    "hippo" => read_only(|| Ok(b"hippo".to_vec())),
                                },
                            },
                        )
                        .map_err(|(s, _)| s)
                        .expect("failed to add data entry");
                }
                pseudo_dir.open(
                    OPEN_RIGHT_READABLE,
                    MODE_TYPE_DIRECTORY,
                    &mut iter::empty(),
                    ServerEnd::new(server_end.into_channel()),
                );

                let _ = await!(pseudo_dir);

                panic!("the pseudo dir exited!");
            });
        })
    }
/// Returns a function that will host this outgoing directory on the given ServerEnd.
Returns a function that will host this outgoing directory on the given ServerEnd.
Returns a function that will host this outgoing directory on the given ServerEnd .
fn host_fn(&self) -> Box<Fn(ServerEnd<DirectoryMarker>) + Send + Sync> {
        let host_service = self.host_service;
        let host_directory = self.host_directory;
        Box::new(move |server_end: ServerEnd<DirectoryMarker>| {
            fasync::spawn(async move {
                let mut pseudo_dir = directory::simple::empty();
                if host_service {
                    pseudo_dir.add_entry("svc",
                            pseudo_directory! {
                                "foo" =>
                                    directory_broker::DirectoryBroker::new_service_broker(Box::new(echo_server_fn)),
                            })
                        .map_err(|(s,_)| s)
                        .expect("failed to add svc entry");
                }
                if host_directory {
                    pseudo_dir
                        .add_entry(
                            "data",
                            pseudo_directory! {
                                "foo" => pseudo_directory! {
                                    "hippo" => read_only(|| Ok(b"hippo".to_vec())),
                                },
                            },
                        )
                        .map_err(|(s, _)| s)
                        .expect("failed to add data entry");
                }
                pseudo_dir.open(
                    OPEN_RIGHT_READABLE,
                    MODE_TYPE_DIRECTORY,
                    &mut iter::empty(),
                    ServerEnd::new(server_end.into_channel()),
                );
                let _ = await!(pseudo_dir);
                panic!("the pseudo dir exited!");
            });
        })
    }
fn host_fn ( & self ) -> Box < Fn ( ServerEnd < DirectoryMarker > ) + Send + Sync > { let host_service = self . host_service ; let host_directory = self . host_directory ; Box :: new ( move | server_end : ServerEnd < DirectoryMarker > | { fasync :: spawn ( async move { let mut pseudo_dir = directory :: simple :: empty ( ) ; if host_service { pseudo_dir . add_entry ( " " , pseudo_directory ! { " " directory_broker DirectoryBroker new_service_broker ( Box new ( echo_server_fn ) ) } ) . map_err ( | ( s , _ ) | s ) . expect ( " " ) ; } if host_directory { pseudo_dir . add_entry ( " " , pseudo_directory ! { " " pseudo_directory { " " read_only ( Ok ( b" " to_vec ( ) ) ) } } , ) . map_err ( | ( s , _ ) | s ) . expect ( " " ) ; } pseudo_dir . open ( OPEN_RIGHT_READABLE , MODE_TYPE_DIRECTORY , & mut iter :: empty ( ) , ServerEnd :: new ( server_end . into_channel ( ) ) , ) ; let _ = await ! ( pseudo_dir ) ; panic ! ( " " ) ; } ) ; } ) }
Returns a function that will host this outgoing directory on the given ServerEnd.
Returns a function that will host this outgoing directory on the given ServerEnd .
&self
&self