Api types
This commit is contained in:
@@ -10,9 +10,28 @@ impl<T> ContPayload for T where T: fmt::Debug + Serialize + Send {}
|
||||
pub trait UserApiType: ToCborValue {}
|
||||
|
||||
pub trait ToUserFacingApiType {
|
||||
fn to_user_facing_api_type(self) -> Box<dyn UserApiType>;
|
||||
fn to_user_facing_api_type(self: Self) -> Box<dyn UserApiType>;
|
||||
fn to_user_facing_api_type_box(self: Box<Self>) -> Box<dyn UserApiType>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct EmptyStruct {}
|
||||
|
||||
impl EmptyStruct {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCborValue for EmptyStruct {
|
||||
fn to_cbor_value(&self) -> Result<ciborium::Value, ciborium::value::Error> {
|
||||
let ret = ciborium::Value::Map(Vec::new());
|
||||
Ok(ret)
|
||||
}
|
||||
}
|
||||
|
||||
impl UserApiType for EmptyStruct {}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct ContainerEventsApi<EVT>
|
||||
where
|
||||
|
||||
@@ -112,12 +112,6 @@ pub trait BinningggContainerEventsDyn:
|
||||
fn as_mergeable_dyn_mut(&mut self) -> &mut dyn MergeableDyn;
|
||||
}
|
||||
|
||||
impl ToUserFacingApiType for Box<dyn BinningggContainerEventsDyn> {
|
||||
fn to_user_facing_api_type(self) -> Box<dyn crate::apitypes::UserApiType> {
|
||||
let inner = *self;
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MergeableDyn for Box<T>
|
||||
where
|
||||
T: MergeableDyn,
|
||||
|
||||
Reference in New Issue
Block a user