pub struct Map { /* private fields */ }
Expand description
High abstraction Map which helps position objects.
Implementations§
Source§impl Map
impl Map
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new map, no min_max are intially required and are generated automatically when calling Map::map.
Sourcepub fn save(self, path: &Path) -> Result<(), Error>
pub fn save(self, path: &Path) -> Result<(), Error>
Saves the image to disk at the given Path.
§Examples
let nodes = Node::from_list(&[(0, 0), (10, 10)]);
Map::new()
.map(&nodes)
.save(Path::new("/tmp/example.png"))?;
Sourcepub fn map<T: Draw + Location + Hash + MinMax>(self, element: &[T]) -> Self
pub fn map<T: Draw + Location + Hash + MinMax>(self, element: &[T]) -> Self
Maps any struct that has implemented Draw, on to an ImageBuffer.
§Examples
let nodes: Vec<Node> = Node::from_list(&[(0, 0), (100, 100)]);
// Add content to vectors.
let mut map = Map::new();
map = map.map(&nodes);
Sourcepub fn map_filter<T: Draw + Location + Hash + MinMax>(
self,
element: &[T],
filter: &dyn Fn(&T) -> bool,
) -> Self
pub fn map_filter<T: Draw + Location + Hash + MinMax>( self, element: &[T], filter: &dyn Fn(&T) -> bool, ) -> Self
Maps the elements but with an added filter parameter to exclude elements.
Sourcepub fn map_shape<T: Draw + Location + Hash + MinMax>(
self,
element: &[T],
shape: &Shape,
) -> Self
pub fn map_shape<T: Draw + Location + Hash + MinMax>( self, element: &[T], shape: &Shape, ) -> Self
Maps the elements with a specified shape struct.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Map
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more