Skip to content

Commit

Permalink
docs: TryHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Dec 31, 2023
1 parent 55356a3 commit d7298ce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions viz-core/src/handler/try_handler.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
use crate::{BoxFuture, Handler};

/// A convenience for handlers that return `Result` values that includes
/// a variety of adapters tailored to such futures.
pub trait TryHandler<Input>: Handler<Input> {
/// The type of successful values yielded by this handler
type Ok;

/// The type of failures yielded by this handler
type Error;

/// Call this `TryHandler` as if it were a `Handler`.
///
/// This method is a stopgap for a compiler limitation that prevents us from
/// directly inheriting from the `Handler` trait; in the future it won't be
/// needed.
fn try_call(&self, input: Input) -> BoxFuture<Result<Self::Ok, Self::Error>>;
}

Expand Down

0 comments on commit d7298ce

Please sign in to comment.