pub struct Project {
pub format: String,
pub version: u32,
pub name: String,
pub circuit: Circuit,
pub files: Vec<SourceFile>,
pub options: Options,
pub extra: BTreeMap<String, Value>,
}Expand description
A complete project.
Fields§
§format: String§version: u32§name: String§circuit: Circuit§files: Vec<SourceFile>§options: Options§extra: BTreeMap<String, Value>Unknown keys survive a save, as in the circuit format.
Implementations§
Source§impl Project
impl Project
Sourcepub fn add_file(
&mut self,
name: impl Into<String>,
content: impl Into<String>,
) -> &mut SourceFile
pub fn add_file( &mut self, name: impl Into<String>, content: impl Into<String>, ) -> &mut SourceFile
Add or replace a file in the project’s own group.
pub fn file(&self, name: &str) -> Option<&SourceFile>
Sourcepub fn group(&self, group: Option<&str>) -> impl Iterator<Item = &SourceFile>
pub fn group(&self, group: Option<&str>) -> impl Iterator<Item = &SourceFile>
Files belonging to one board’s group.
Sourcepub fn validate(&self) -> Result<(), ProjectError>
pub fn validate(&self) -> Result<(), ProjectError>
Structural checks a hand-edited file can fail.
pub fn to_json(&self) -> Result<String, ProjectError>
pub fn from_json(text: &str) -> Result<Self, ProjectError>
pub fn save(&self, path: &Path) -> Result<(), ProjectError>
pub fn load(path: &Path) -> Result<Self, ProjectError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Project
impl<'de> Deserialize<'de> for Project
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for Project
impl Freeze for Projectwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<PartInstance>: Freeze,
PhantomData<Connection>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<SourceFile>: Freeze,
impl Move for Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnsafeUnpin for Projectwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<PartInstance>: UnsafeUnpin,
PhantomData<Connection>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<SourceFile>: UnsafeUnpin,
impl UnwindSafe for Project
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more