farm.rs (1777B)
1 //! Farm, cooperative, plot, resource, and farm-document event models. 2 3 #[cfg(not(feature = "std"))] 4 use alloc::{string::String, vec::Vec}; 5 6 #[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))] 7 #[cfg_attr(all(test, feature = "std"), dto(export))] 8 #[cfg_attr( 9 any(feature = "serde", test), 10 derive(serde::Serialize, serde::Deserialize) 11 )] 12 #[derive(Clone, Debug)] 13 pub struct Farm { 14 pub d_tag: String, 15 pub name: String, 16 pub about: Option<String>, 17 pub website: Option<String>, 18 pub picture: Option<String>, 19 pub banner: Option<String>, 20 pub location: Option<FarmPublicLocation>, 21 pub tags: Option<Vec<String>>, 22 } 23 24 #[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))] 25 #[cfg_attr(all(test, feature = "std"), dto(export))] 26 #[cfg_attr( 27 any(feature = "serde", test), 28 derive(serde::Serialize, serde::Deserialize) 29 )] 30 #[derive(Clone, Debug, Default)] 31 pub struct FarmRef { 32 pub pubkey: String, 33 pub d_tag: String, 34 } 35 36 #[cfg_attr(all(test, feature = "std"), derive(dto_bindgen::Dto))] 37 #[cfg_attr(all(test, feature = "std"), dto(export))] 38 #[cfg_attr( 39 any(feature = "serde", test), 40 derive(serde::Serialize, serde::Deserialize) 41 )] 42 #[derive(Clone, Debug)] 43 pub struct FarmPublicLocation { 44 pub primary: String, 45 pub city: Option<String>, 46 pub region: Option<String>, 47 pub country: Option<String>, 48 pub geohash: String, 49 } 50 #[path = "gcs.rs"] 51 pub mod change_set; 52 #[path = "coop.rs"] 53 pub mod coop; 54 #[path = "farm_crdt.rs"] 55 pub mod crdt; 56 #[path = "farm_file.rs"] 57 pub mod file; 58 #[path = "location.rs"] 59 pub mod location; 60 #[path = "plot.rs"] 61 pub mod plot; 62 #[path = "resource_area.rs"] 63 pub mod resource_area; 64 #[path = "resource_cap.rs"] 65 pub mod resource_cap; 66 #[path = "farm_workspace.rs"] 67 pub mod workspace;