Consolidate "board", shortening "runner"

This commit is contained in:
Nicolas Stalder
2021-01-30 03:13:48 +01:00
committed by Nicolas Stalder
parent e6bc091cf4
commit e7ddc0a130
3 changed files with 2 additions and 94 deletions
-22
View File
@@ -377,25 +377,3 @@ pub mod reply {
}
}
// TODO: can we find a nicer syntax for this?
generate_api! {
CreateObject: 1
in: {
attributes: Attributes
}
out: {
object: ObjectHandle
}
DeriveKey: 2
in: {
mechanism: Mechanism
base_key: ObjectHandle
}
out: {
derived_key: ObjectHandle
}
}
-72
View File
@@ -99,75 +99,3 @@ macro_rules! impl_reply {
)*}
}
macro_rules! generate_api {
($(
$which:ident: $index:literal
in: {$($arg_name:tt: $arg_type:path)*}
out: {$($ret_name:tt: $ret_type:path)*}
)*) => {
#[derive(Clone, Eq, PartialEq, Debug)]
pub enum Request2 {
DummyRequest, // for testing
$(
$which(request2::$which),
)*
}
#[derive(Clone, Eq, PartialEq, Debug)]
pub enum Reply2 {
DummyReply, // for testing
$(
$which(reply2::$which),
)*
}
pub mod request2 {
use super::*;
$(
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct $which {
$(
pub $arg_name: $arg_type,
)*
}
)*
}
pub mod reply2 {
use super::*;
$(
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct $which {
$(
pub $ret_name: $ret_type,
)*
}
)*
}
impl From<&mut Request2> for u8 {
fn from(request: &mut Request2) -> u8 {
match request {
Request2::DummyRequest => 0,
$(
Request2::$which(_) => $index,
)*
}
}
}
impl From<&mut Reply2> for u8 {
fn from(reply: &mut Reply2) -> u8 {
match reply {
Reply2::DummyReply => 0,
$(
Reply2::$which(_) => $index,
)*
}
}
}
}}
+2
View File
@@ -1,3 +1,5 @@
//! TODO: split this out into a separate `trussed-board` traits crate.
pub use rand_core::RngCore;
pub use crate::store::Store;
pub use crate::types::{ui, reboot};