MCPcopy Create free account
hub / github.com/eigenform/perfect / from_pattern

Method from_pattern

perfect/src/experiments/branch.rs:81–89  ·  view source on GitHub ↗
(size: usize, pattern: &[T])

Source from the content-addressed store, hash-verified

79 }
80 }
81 pub fn from_pattern<T: Clone + Into<usize>>(size: usize, pattern: &[T]) -> Self
82 {
83 let mut data = vec![0; size];
84 for (idx, val) in data.iter_mut().enumerate() {
85 let x = pattern[idx % pattern.len()].clone();
86 *val = x.into();
87 }
88 Self { data }
89 }
90 pub fn append_from_slice<T: Copy + Into<usize>>(&mut self, slice: &[T]) {
91 for val in slice.iter() {
92 self.data.push((*val).into());

Callers

nothing calls this directly

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected