#[non_exhaustive]pub struct Move {
pub direction: Face6,
pub distance: u16,
pub velocity: i16,
pub schedule: Schedule,
}Expand description
Data for Modifier::Move; displaces the block out of the grid, cropping it.
A pair of Moves can depict a block moving between two cubes.
§Animation
- If the
distanceis zero then the modifier will remove itself, if possible, on the next tick. - If the
distanceandvelocityare such that the block is out of view and will never start being in view, the block will be replaced withAIR.
(TODO: Define the conditions for “if possible”.)
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.direction: Face6The direction in which the block is displaced.
distance: u16The distance, in 1/256ths, by which it is displaced.
velocity: i16The amount by which self.distance is changing every time
self.schedule fires.
schedule: ScheduleWhen to apply the velocity.
If self.velocity is zero, this is ignored.
Implementations§
Source§impl Move
impl Move
Sourcepub fn new(direction: Face6, distance: u16, velocity: i16) -> Self
pub fn new(direction: Face6, distance: u16, velocity: i16) -> Self
TODO: make a cleaner, less internals-ish constructor
Sourcepub fn into_paired(self) -> [Self; 2]
pub fn into_paired(self) -> [Self; 2]
Create a pair of Moves to displace a block.
The first goes on the block being moved, and the second on the air
it’s moving into.
Sourcepub fn complement(&self) -> Self
pub fn complement(&self) -> Self
Calculate the modifier which should be paired with this one, and located at the adjacent
cube pointed to by Self::direction, to produce a complete moving block across two
cubes.
Sourcepub fn rotate(self, rotation: GridRotation) -> Self
pub fn rotate(self, rotation: GridRotation) -> Self
Rotate the movement direction as specified.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Move
impl<'arbitrary> Arbitrary<'arbitrary> for Move
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl VisitHandles for Move
impl VisitHandles for Move
Source§fn visit_handles(&self, _visitor: &mut dyn HandleVisitor)
fn visit_handles(&self, _visitor: &mut dyn HandleVisitor)
impl Eq for Move
impl StructuralPartialEq for Move
Auto Trait Implementations§
impl Freeze for Move
impl RefUnwindSafe for Move
impl Send for Move
impl Sync for Move
impl Unpin for Move
impl UnwindSafe for Move
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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