pub struct TreadlingInfo { /* private fields */ }Expand description
The treadling or lift plan for a draft, also includes the tie-up and whether the loom is rising or sinking shed
Implementations§
Source§impl TreadlingInfo
impl TreadlingInfo
Sourcepub fn new(shaft_count: u32, tie_up: TieUpCreate, rise_sink: RiseSink) -> Self
pub fn new(shaft_count: u32, tie_up: TieUpCreate, rise_sink: RiseSink) -> Self
Sourcepub fn shaft_count(&self) -> u32
pub fn shaft_count(&self) -> u32
Get the shaft count
Sourcepub fn max_shaft_used(&self) -> u32
pub fn max_shaft_used(&self) -> u32
Returns max shaft used. If this is a direct tie-up, it’s the max shaft in the lift plan. If it’s an indirect tie-up, it’s the max shaft used in the tie-up, even if no picks use a treadle tied to that shaft
Sourcepub fn set_shaft_count(&mut self, shaft_count: u32) -> Result<(), u32>
pub fn set_shaft_count(&mut self, shaft_count: u32) -> Result<(), u32>
Non-destructively sets shaft count
§Errors
If shaft_count is less than the max shaft used, returns max shaft
Sourcepub fn treadle_count(&self) -> u32
pub fn treadle_count(&self) -> u32
Get the treadle count. Returns the shaft count if directly tied up
Sourcepub fn rise_sink(&self) -> RiseSink
pub fn rise_sink(&self) -> RiseSink
Whether the treadling is for a rising shaft or sinking shaft loom
Sourcepub fn push_single(&mut self, treadle: u32) -> Result<(), u32>
pub fn push_single(&mut self, treadle: u32) -> Result<(), u32>
Add a new pick at the end using just the given treadle
§Errors
If treadle is higher than number of shafts, returns treadle
Sourcepub fn push(&mut self, treadles: HashSet<u32>) -> Result<(), u32>
pub fn push(&mut self, treadles: HashSet<u32>) -> Result<(), u32>
Add a new pick at the end using all given treadles/shafts
§Errors
If any treadle is over the number of treadles/shafts, returns that value
Sourcepub fn splice<R>(
&mut self,
range: R,
replace_with: Vec<HashSet<u32>>,
) -> Result<Vec<HashSet<u32>>, u32>where
R: RangeBounds<usize>,
pub fn splice<R>(
&mut self,
range: R,
replace_with: Vec<HashSet<u32>>,
) -> Result<Vec<HashSet<u32>>, u32>where
R: RangeBounds<usize>,
Based on Vec::splice, it splices the given sequence into the given range. It validates that
the elements in replace_with are inside the shaft bounds, and it returns the replaced elements.
§Errors
If an element in replace_with is larger than the shaft count, returns index of first
out-of-bounds element
Sourcepub fn put(
&mut self,
index: usize,
treadles: HashSet<u32>,
) -> Result<Option<HashSet<u32>>, u32>
pub fn put( &mut self, index: usize, treadles: HashSet<u32>, ) -> Result<Option<HashSet<u32>>, u32>
Sourcepub fn make_rising(&mut self)
pub fn make_rising(&mut self)
Convert in place to a rising shaft treadling
Sourcepub fn make_sinking(&mut self)
pub fn make_sinking(&mut self)
Convert in place to a sinking shaft treadling
Sourcepub fn make_lift_plan(&mut self) -> bool
pub fn make_lift_plan(&mut self) -> bool
Goes from a treadling to a lift plan. Returns false if already a lift plan, true if conversion happened
Trait Implementations§
Source§impl Clone for TreadlingInfo
impl Clone for TreadlingInfo
Source§fn clone(&self) -> TreadlingInfo
fn clone(&self) -> TreadlingInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more