pub mod codec;
pub mod error;
pub mod ids;
pub mod il;
pub mod il_executor;
pub mod il_extended;
pub mod msg;
pub mod promise;
pub mod promise_map;
#[cfg(feature = "validation")]
pub mod validate;
pub mod protocol;
pub use codec::{decode_message, encode_message};
pub use error::{ErrorCode, RpcError};
pub use ids::{CallId, CapId, PromiseId};
pub use il::{Op, Plan, Source};
pub use il_executor::ILExecutor;
pub use il_extended::{ILContext, ILError, ILExpression, ILOperation, ILPlan};
pub use msg::{Message, Outcome, Target};
pub use promise::{ArgValue, ExtendedTarget, PendingPromise, PromiseDependencyGraph};
pub use promise_map::{MapOperation, PipelinedCall, PromiseMapExecutor};
pub use protocol::{
capability_registry::{CapabilityRegistry, RegistrableCapability},
ids::{ExportId, ImportId},
tables::{ExportTable, ImportTable, Value},
wire::{parse_wire_batch, serialize_wire_batch, PropertyKey, WireExpression, WireMessage},
};
pub use protocol::{expression::Expression, message::Message as LegacyMessage};
pub use async_trait::async_trait;
#[async_trait]
pub trait RpcTarget: Send + Sync + std::fmt::Debug {
async fn call(&self, method: &str, args: Vec<Value>) -> Result<Value, RpcError>;
async fn get_property(&self, property: &str) -> Result<Value, RpcError>;
}
#[cfg(test)]
#[derive(Debug)]
pub struct MockRpcTarget {}
#[cfg(test)]
impl MockRpcTarget {
pub fn new() -> Self {
Self {}
}
}
#[cfg(test)]
impl Default for MockRpcTarget {
fn default() -> Self {
Self::new()
}
}
#[cfg(test)]
#[async_trait]
impl RpcTarget for MockRpcTarget {
async fn call(&self, method: &str, args: Vec<Value>) -> Result<Value, RpcError> {
Ok(Value::String(format!(
"Mock call to {} with {} args",
method,
args.len()
)))
}
async fn get_property(&self, property: &str) -> Result<Value, RpcError> {
Ok(Value::String(format!("Mock property {}", property)))
}
}