pub struct Channel { /* private fields */ }Expand description
One kind of request and its answers.
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn request_path(&self, state_dir: &Path) -> PathBuf
pub fn request_path(&self, state_dir: &Path) -> PathBuf
Where a single-slot channel’s request lives.
Sourcepub fn take(&self, state_dir: &Path) -> Vec<String>
pub fn take(&self, state_dir: &Path) -> Vec<String>
Takes the pending requests and returns their identifiers. Taking one is deleting it, so a request is answered once.
Sourcepub fn answer<T: Serialize>(
&self,
state_dir: &Path,
request: &str,
outcome: Result<T, String>,
) -> Result<()>
pub fn answer<T: Serialize>( &self, state_dir: &Path, request: &str, outcome: Result<T, String>, ) -> Result<()>
Sourcepub fn read_answer<T: DeserializeOwned>(
&self,
state_dir: &Path,
request: &str,
) -> Option<Result<T, String>>
pub fn read_answer<T: DeserializeOwned>( &self, state_dir: &Path, request: &str, ) -> Option<Result<T, String>>
The service’s answer to request, once it has given one.
Trait Implementations§
impl Copy for Channel
impl Eq for Channel
impl StructuralPartialEq for Channel
Auto Trait Implementations§
impl Forget for Channel
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
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