Add Margins::zeroes

This commit is contained in:
Alexandre Bury 2020-12-18 14:08:09 -08:00
parent 418fda99ba
commit d464dc8ce0

View File

@ -23,6 +23,11 @@ impl Margins {
Self::lrtb(left, right, top, bottom) Self::lrtb(left, right, top, bottom)
} }
/// Creates a new `Margins` object with zero margins.
pub fn zeroes() -> Self {
Self::lrtb(0, 0, 0, 0)
}
/// Creates a new `Margins` object from the Left, Right, Top, Bottom fields. /// Creates a new `Margins` object from the Left, Right, Top, Bottom fields.
pub fn lrtb(left: usize, right: usize, top: usize, bottom: usize) -> Self { pub fn lrtb(left: usize, right: usize, top: usize, bottom: usize) -> Self {
Margins { Margins {