From 32213cb82022d0d75530375cd11cd1046bda2133 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 4 May 2021 21:50:22 +0100 Subject: [PATCH] bundles: Sort out private/public types etc. Signed-off-by: Ian Jackson --- src/bundles.rs | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/bundles.rs b/src/bundles.rs index 293e2c74..17e4d3a2 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -35,16 +35,6 @@ pub struct InstanceBundles { bundles: Vec>, } -//---------- private definitions ---------- - -const BUNDLES_MAX: Index = Index(64); - -#[derive(Debug,Clone,Serialize,Deserialize)] -pub struct Note { - pub kind: Kind, - pub state: State, -} - #[derive(Debug,Clone,Serialize,Deserialize)] pub enum State { Uploading, @@ -54,16 +44,20 @@ pub enum State { #[derive(Debug,Clone,Serialize,Deserialize)] pub struct Loaded { - meta: BundleMeta, + pub meta: BundleMeta, } +/// returned by start_upload pub struct Uploading { instance: Arc, id: Id, file: DigestWrite>, } -type BadBundle = String; // todo: make this a newtype +#[derive(Debug,Copy,Clone,Error)] +#[error("{0}")] +#[repr(transparent)] +pub struct NotBundle(&'static str); #[derive(Error,Debug)] pub enum LoadError { @@ -71,12 +65,18 @@ pub enum LoadError { IE(#[from] IE), } display_as_debug!{LoadError} -use LoadError as LE; -#[derive(Debug,Copy,Clone,Error)] -#[error("{0}")] -#[repr(transparent)] -pub struct NotBundle(&'static str); +//---------- private definitions ---------- + +const BUNDLES_MAX: Index = Index(64); + +#[derive(Debug,Clone,Serialize,Deserialize)] +struct Note { + pub kind: Kind, + pub state: State, +} + +pub type BadBundle = String; #[derive(Error,Debug)] enum IncorporateError { @@ -84,6 +84,8 @@ enum IncorporateError { #[error("{0}")] IE(#[from] IE), } +use LoadError as LE; + //---------- straightformward impls ---------- impl From for usize { -- 2.30.2