Add a bunch of `#[inline]`
This commit is contained in:
parent
a726e656a4
commit
4060d02f27
|
|
@ -145,12 +145,14 @@ pub enum SizeHint {
|
|||
}
|
||||
|
||||
impl Default for SizeHint {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
Self::Scale(1.0.ord())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec2> for SizeHint {
|
||||
#[inline]
|
||||
fn from(value: Vec2) -> Self {
|
||||
Self::Size(value.x.round() as u32, value.y.round() as u32)
|
||||
}
|
||||
|
|
@ -412,6 +414,7 @@ impl From<(TextureId, Vec2)> for SizedTexture {
|
|||
}
|
||||
|
||||
impl<'a> From<&'a TextureHandle> for SizedTexture {
|
||||
#[inline]
|
||||
fn from(handle: &'a TextureHandle) -> Self {
|
||||
Self::from_handle(handle)
|
||||
}
|
||||
|
|
@ -435,6 +438,7 @@ pub enum TexturePoll {
|
|||
}
|
||||
|
||||
impl TexturePoll {
|
||||
#[inline]
|
||||
pub fn size(self) -> Option<Vec2> {
|
||||
match self {
|
||||
TexturePoll::Pending { size } => size,
|
||||
|
|
|
|||
|
|
@ -409,6 +409,7 @@ impl Rect {
|
|||
|
||||
/// Linearly interpolate so that `[0, 0]` is [`Self::min`] and
|
||||
/// `[1, 1]` is [`Self::max`].
|
||||
#[inline]
|
||||
pub fn lerp_inside(&self, t: Vec2) -> Pos2 {
|
||||
Pos2 {
|
||||
x: lerp(self.min.x..=self.max.x, t.x),
|
||||
|
|
@ -417,6 +418,7 @@ impl Rect {
|
|||
}
|
||||
|
||||
/// Linearly self towards other rect.
|
||||
#[inline]
|
||||
pub fn lerp_towards(&self, other: &Rect, t: f32) -> Self {
|
||||
Self {
|
||||
min: self.min.lerp(other.min, t),
|
||||
|
|
@ -611,6 +613,7 @@ impl std::fmt::Debug for Rect {
|
|||
|
||||
/// from (min, max) or (left top, right bottom)
|
||||
impl From<[Pos2; 2]> for Rect {
|
||||
#[inline]
|
||||
fn from([min, max]: [Pos2; 2]) -> Self {
|
||||
Self { min, max }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue