1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//! Library-specific error types and utility functions

/// Error type for wasmRS Runtime errors.
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone)]
pub enum Error {
  /// Sending on the channel failed.
  SendFailed(u8),
  /// Receiving from the channel failed.
  RecvFailed(u8),
}

impl std::error::Error for Error {}
impl std::fmt::Display for Error {
  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    match self {
      Error::SendFailed(_) => f.write_str("Send failed"),
      Error::RecvFailed(_) => f.write_str("Receive failed"),
    }
  }
}