pub struct LaneTable { /* private fields */ }Expand description
The lanes of one laned state: which are taken, and which of them a turn seats.
Plain data. Taking a lane does not touch the state’s buffers, and clearing what a stream left in a lane it gave up is the table’s caller’s, since it writes the state – device memory for a state on a GPU – and must run where the state lives. So a lane handed to a new stream carries the previous one’s history until that caller resets it.
Implementations§
Source§impl LaneTable
impl LaneTable
pub fn new(max_lanes: usize) -> TractResult<LaneTable>
Sourcepub fn max_lanes(&self) -> usize
pub fn max_lanes(&self) -> usize
The extent of the lane axis of the state’s per-lane buffers, fixed for the life of the state.
pub fn taken(&self) -> usize
Sourcepub fn take(&mut self) -> Option<LaneId>
pub fn take(&mut self) -> Option<LaneId>
The lowest free lane, None when every lane is taken – whether that
blocks the new stream or fails it is the caller’s policy. Lowest first,
so that a turn seating every lane seats a run of consecutive lanes.
Sourcepub fn give_back(&mut self, lane: LaneId) -> TractResult<()>
pub fn give_back(&mut self, lane: LaneId) -> TractResult<()>
Hand lane back, for LaneTable::take to give to another stream.
pub fn is_taken(&self, lane: LaneId) -> bool
Sourcepub fn seat(
&self,
lanes: impl IntoIterator<Item = LaneId>,
) -> TractResult<Seating>
pub fn seat( &self, lanes: impl IntoIterator<Item = LaneId>, ) -> TractResult<Seating>
Seat lanes, in that order: seat ix of the coming turn carries the
ixth of them. Every one must be taken, so that a stream which ended
can not be seated by a stale handle of it.
Trait Implementations§
impl Eq for LaneTable
impl StructuralPartialEq for LaneTable
Auto Trait Implementations§
impl Freeze for LaneTable
impl RefUnwindSafe for LaneTable
impl Send for LaneTable
impl Sync for LaneTable
impl Unpin for LaneTable
impl UnsafeUnpin for LaneTable
impl UnwindSafe for LaneTable
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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