pub(super) struct RailState<'a> {
world: &'a Arc<World>,
pos: BlockPos,
state: BlockStateId,
is_straight: bool,
connections: Vec<BlockPos>,
}Expand description
Vanilla’s ordered, mutable rail connection resolver.
connections intentionally remains a Vec: insertion and traversal order
affects curve selection and synchronous neighbor updates.
Fields§
§world: &'a Arc<World>§pos: BlockPos§state: BlockStateId§is_straight: bool§connections: Vec<BlockPos>Implementations§
Source§impl<'a> RailState<'a>
impl<'a> RailState<'a>
pub(super) fn new( world: &'a Arc<World>, pos: BlockPos, state: BlockStateId, ) -> Option<Self>
pub(super) fn connections(&self) -> &[BlockPos]
fn update_connections(&mut self, shape: RailShape)
fn remove_soft_connections(&mut self)
fn has_rail(&self, pos: BlockPos) -> bool
fn get_rail(&self, pos: BlockPos) -> Option<Self>
fn connects_to(&self, rail: &Self) -> bool
fn has_connection(&self, rail_pos: BlockPos) -> bool
pub(super) fn count_potential_connections(&self) -> usize
fn can_connect_to(&self, rail: &Self) -> bool
fn connect_to(&mut self, rail: &Self)
fn has_neighbor_rail(&self, rail_pos: BlockPos) -> bool
Sourcepub(super) fn place(
&mut self,
has_signal: bool,
first: bool,
default_shape: RailShape,
) -> BlockStateId
pub(super) fn place( &mut self, has_signal: bool, first: bool, default_shape: RailShape, ) -> BlockStateId
Places this rail and synchronously connects neighbors in vanilla order.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for RailState<'a>
impl<'a> !UnwindSafe for RailState<'a>
impl<'a> Freeze for RailState<'a>
impl<'a> Send for RailState<'a>
impl<'a> Sync for RailState<'a>
impl<'a> Unpin for RailState<'a>
impl<'a> UnsafeUnpin for RailState<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreWraps this value in an
Arc<SyncMutex<>>