#[non_exhaustive]pub struct InteractiveHtmlBom {Show 21 fields
pub view_mode: ViewMode,
pub highlight_pin1: HighlightPin1Mode,
pub dark_mode: bool,
pub board_rotation: f32,
pub offset_back_rotation: bool,
pub show_silkscreen: bool,
pub show_fabrication: bool,
pub show_pads: bool,
pub checkboxes: Vec<String>,
pub fields: Vec<String>,
pub user_header: String,
pub user_footer: String,
pub user_js: String,
pub drawings: Vec<Drawing>,
pub tracks: Vec<Track>,
pub vias: Vec<Via>,
pub zones: Vec<Zone>,
pub footprints: Vec<Footprint>,
pub bom_front: Vec<Vec<RefMap>>,
pub bom_back: Vec<Vec<RefMap>>,
pub bom_both: Vec<Vec<RefMap>>,
/* private fields */
}
Expand description
Interactive HTML BOM structure
The top-level structure to build & generate a HTML BOM.
Please note that this struct is not completely fool-proof as it does not
validate lots of the added data. So make sure you add only valid BOM data.
Only the most important things are validated to avoid generating completely
broken HTML pages: Footprint IDs in BOM rows, and number of fields in
footprints.
§Examples
use interactive_html_bom::*;
let mut ibom = InteractiveHtmlBom::new(
"My Project", // Title
"My Company", // Company
"Rev. 1", // Revision
"1970-01-01", // Date
(0.0, 0.0), // Bottom left
(100.0, 80.0), // Top right
);
// Set configuration.
ibom.fields = vec!["Value".into(), "Footprint".into()];
// Draw PCB.
ibom.drawings.push(Drawing::new(
DrawingKind::Polygon, // Kind of drawing
DrawingLayer::Edge, // Layer
"M 0 0 H 100 V 80 H -100 V -80", // SVG path
0.1, // Line width
false, // Filled
));
ibom.drawings.push(Drawing::new(
DrawingKind::ReferenceText,
DrawingLayer::SilkscreenFront,
"M 10 10 H 80 V 60 H -80 V -60",
0.1,
false,
));
// Add footprints.
let id = ibom.add_footprint(
Footprint::new(
Layer::Front, // Layer
(50.0, 40.0), // Position
45.0, // Rotation
(-2.0, -1.0), // Bottom left
(2.0, 1.0), // Top right
&["100R".into(), "0603".into()], // Fields
&[Pad::new(
&[Layer::Front], // Pad layers
(-2.0, 0.0), // Pad position
0.0, // Pad rotation
"M -1 -1 H 2 V 2 H -2 V -2", // Pad shape (SVG)
None, // Pad drill
None, // Pad net
true, // Pin 1
),
// [...]
],
true, // Mount or not
),
);
// Add BOM rows (designators and their footprint IDs).
ibom.bom_front.push(vec![RefMap::new("R1", id)]);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.view_mode: ViewMode
Initial view mode
highlight_pin1: HighlightPin1Mode
Hightlight pin-1 mode
dark_mode: bool
Dark mode on/off
board_rotation: f32
Board drawings rotation [°]
offset_back_rotation: bool
Whether to offset the back side rotation or not
show_silkscreen: bool
Silkscreen visibility
show_fabrication: bool
Fabrication layer visibility
show_pads: bool
Pads visibility
checkboxes: Vec<String>
Checkbox column names
fields: Vec<String>
Custom field names, listed as columns
user_header: String
User-defined HTML header
This should be used carefully as we neither guarantee forward- nor
backward-compatibility.
User-defined HTML footer
This should be used carefully as we neither guarantee forward- nor
backward-compatibility.
user_js: String
User-defined JavaScript
This should be used carefully as we neither guarantee forward- nor
backward-compatibility.
drawings: Vec<Drawing>
Drawings (PCB edges, silkscreen, fabrication)
tracks: Vec<Track>
PCB tracks
vias: Vec<Via>
PCB vias
zones: Vec<Zone>
PCB zones
footprints: Vec<Footprint>
Footprints
bom_front: Vec<Vec<RefMap>>
BOM rows front side
bom_back: Vec<Vec<RefMap>>
BOM rows back side
bom_both: Vec<Vec<RefMap>>
BOM rows front+back
Implementations§
Source§impl InteractiveHtmlBom
impl InteractiveHtmlBom
Auto Trait Implementations§
impl Freeze for InteractiveHtmlBom
impl RefUnwindSafe for InteractiveHtmlBom
impl Send for InteractiveHtmlBom
impl Sync for InteractiveHtmlBom
impl Unpin for InteractiveHtmlBom
impl UnwindSafe for InteractiveHtmlBom
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