pub struct GradientStops { /* private fields */ }Expand description
Inline stop table for PaintDesc::LinearStops / PaintDesc::RadialStops.
Stored by value (no heap, no lifetime) so PaintDesc stays Copy and
SceneNode stays lifetime-free. Longer input is truncated to the first
MAX_GRADIENT_STOPS: from_slice logs the overflow,
try_from_slice reports it instead.
Implementations§
Source§impl GradientStops
impl GradientStops
Sourcepub fn from_slice(slice: &[GradientStop]) -> Self
pub fn from_slice(slice: &[GradientStop]) -> Self
The first MAX_GRADIENT_STOPS of slice; logs how many were dropped.
Sourcepub fn try_from_slice(slice: &[GradientStop]) -> Option<Self>
pub fn try_from_slice(slice: &[GradientStop]) -> Option<Self>
Like from_slice but None when slice does not
fit, so hosts can validate before submitting a draw.
Sourcepub fn push(&mut self, stop: GradientStop) -> bool
pub fn push(&mut self, stop: GradientStop) -> bool
Append a stop; false when the table is already full.
pub fn as_slice(&self) -> &[GradientStop]
pub fn as_mut_slice(&mut self) -> &mut [GradientStop]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for GradientStops
impl Clone for GradientStops
impl Copy for GradientStops
Source§impl Debug for GradientStops
impl Debug for GradientStops
Source§impl Default for GradientStops
impl Default for GradientStops
Source§impl<'a> From<&'a [GradientStop]> for GradientStops
impl<'a> From<&'a [GradientStop]> for GradientStops
Source§fn from(slice: &'a [GradientStop]) -> Self
fn from(slice: &'a [GradientStop]) -> Self
Converts to this type from the input type.
Source§impl PartialEq for GradientStops
impl PartialEq for GradientStops
impl StructuralPartialEq for GradientStops
Auto Trait Implementations§
impl Freeze for GradientStops
impl RefUnwindSafe for GradientStops
impl Send for GradientStops
impl Sync for GradientStops
impl Unpin for GradientStops
impl UnsafeUnpin for GradientStops
impl UnwindSafe for GradientStops
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