fn element(&self, number: usize, element: &Element) -> Option<String> {
        match element {
            Element::Line(l) => Some(format!(
                "P {points_number} {unit} {convert} {thickness} {x1} {y1} {x2} {y2} N",
                points_number = 2,
                unit = number,
                convert = 1, // 0 if common to the 2 representations, if not 1 or 2
                thickness = l.width.round(),
                x1 = l.p.0.x.round(),
                y1 = l.p.0.y.round(),
                x2 = l.p.1.x.round(),
                y2 = l.p.1.y.round(),
            )),
            Element::SymbolPin(sym_pin) => Some(format!(
                "X {name} {number} {posx} {posy} {length} {orientation} {snum} {snom} \
                {unit} {convert} {etype} {visibility}{shape}",
                name = sym_pin.pin.name,
                number = sym_pin.pin.number,
                posx = sym_pin.origin.x.round(),
                posy = sym_pin.origin.y.round(),
                length = sym_pin.length.round(),
                orientation = sym_pin.direction,
                snum = self.font_size_pin,  // pin number text size
                snom = self.font_size_name, // pin name text size
                unit = number, // 0 if common to all parts. If not, number of the part (1. .n)
                convert = 1,   // 0 if common to the representations, if not 1 or 2
                etype = sym_pin.pin.kind,
                visibility = match sym_pin.visibility {
                    Visibility(true) => "",
                    Visibility(false) => "N",
                },
                shape = sym_pin.pin.shape,
            )),
            _ => None,
        }
    }
// Render element to a library file record
Render element to a library file record
Render element to a library file record
fn element(&self, number: usize, element: &Element) -> Option<String> {
        match element {
            Element::Line(l) => Some(format!(
                "P {points_number} {unit} {convert} {thickness} {x1} {y1} {x2} {y2} N",
                points_number = 2,
                unit = number,
                convert = 1, // 0 if common to the 2 representations, if not 1 or 2
                thickness = l.width.round(),
                x1 = l.p.0.x.round(),
                y1 = l.p.0.y.round(),
                x2 = l.p.1.x.round(),
                y2 = l.p.1.y.round(),
            )),
            Element::SymbolPin(sym_pin) => Some(format!(
                "X {name} {number} {posx} {posy} {length} {orientation} {snum} {snom} \
                {unit} {convert} {etype} {visibility}{shape}",
                name = sym_pin.pin.name,
                number = sym_pin.pin.number,
                posx = sym_pin.origin.x.round(),
                posy = sym_pin.origin.y.round(),
                length = sym_pin.length.round(),
                orientation = sym_pin.direction,
                snum = self.font_size_pin,  // pin number text size
                snom = self.font_size_name, // pin name text size
                unit = number, // 0 if common to all parts. If not, number of the part (1. .n)
                convert = 1,   // 0 if common to the representations, if not 1 or 2
                etype = sym_pin.pin.kind,
                visibility = match sym_pin.visibility {
                    Visibility(true) => "",
                    Visibility(false) => "N",
                },
                shape = sym_pin.pin.shape,
            )),
            _ => None,
        }
    }
fn element ( & self , number : usize , element : & Element ) -> Option < String > { match element { Element :: Line ( l ) => Some ( format ! ( " " points_number 2 unit number convert 1 // 0 if common to the 2 representations, if not 1 or 2 thickness l width round ( ) x1 l p 0 x round ( ) y1 l p 0 y round ( ) x2 l p 1 x round ( ) y2 l p 1 y round ( ) ) ) , Element :: SymbolPin ( sym_pin ) => Some ( format ! ( " \
 " name sym_pin pin name number sym_pin pin number posx sym_pin origin x round ( ) posy sym_pin origin y round ( ) length sym_pin length round ( ) orientation sym_pin direction snum self font_size_pin // pin number text size snom self font_size_name // pin name text size unit number // 0 if common to all parts. If not, number of the part (1. .n) convert 1 // 0 if common to the representations, if not 1 or 2 etype sym_pin pin kind visibility match sym_pin visibility { Visibility ( true ) " " Visibility ( false ) " " } shape sym_pin pin shape ) ) , _ => None , } }
Render element to a library file record
Render element to a library file record
&self
number
usize
element
&Element
&self
number
usize
element
&Element