pub enum ProgramPoint {
Invalid,
Block {
block: BlockRef,
position: Position,
},
Op {
op: OperationRef,
position: Position,
},
}Expand description
ProgramPoint represents a specific location in the execution of a program.
A program point consists of two parts:
- An anchor, either a block or operation
- A position, i.e. the direction relative to the anchor to which the program point refers
A program point can be reified as a cursor within a block, such that an operation inserted at the cursor will be placed at the specified position relative to the anchor.
Variants§
Invalid
A program point which refers to nothing, and is always invalid if used
Block
A program point referring to the entry or exit of a block
Fields
Op
A program point referring to the entry or exit of an operation
Fields
op: OperationRefThe operation this program point refers to
Implementations§
Source§impl ProgramPoint
impl ProgramPoint
Sourcepub fn before(entity: impl Into<ProgramPoint>) -> Self
pub fn before(entity: impl Into<ProgramPoint>) -> Self
Create a ProgramPoint at entry to entity, i.e. “before”
Sourcepub fn after(entity: impl Into<ProgramPoint>) -> Self
pub fn after(entity: impl Into<ProgramPoint>) -> Self
Create a ProgramPoint at exit from entity, i.e. “after”
Sourcepub fn at_start_of(block: impl Into<BlockPoint>) -> Self
pub fn at_start_of(block: impl Into<BlockPoint>) -> Self
Create a ProgramPoint at entry to block, i.e. “before”
Sourcepub fn at_end_of(block: impl Into<BlockPoint>) -> Self
pub fn at_end_of(block: impl Into<BlockPoint>) -> Self
Create a ProgramPoint at exit from block, i.e. “after”
Sourcepub fn is_at_block_start(&self) -> bool
pub fn is_at_block_start(&self) -> bool
Returns true if this program point is at the start of the containing block
Sourcepub fn is_at_block_end(&self) -> bool
pub fn is_at_block_end(&self) -> bool
Returns true if this program point is at the end of the containing block
Sourcepub fn block(&self) -> Option<BlockRef>
pub fn block(&self) -> Option<BlockRef>
Returns the block of the program point anchor.
Returns None, if the program point is either invalid, or pointing to an orphaned operation
Sourcepub fn operation(&self) -> Option<OperationRef>
pub fn operation(&self) -> Option<OperationRef>
Returns the program point anchor as an operation.
Returns None if the program point is either invalid, or not pointing to a specific op
Sourcepub fn next_operation(&self) -> Option<OperationRef>
pub fn next_operation(&self) -> Option<OperationRef>
Returns the operation after Self::operation, relative to this program point.
If the current program point is in an orphaned operation, this will return the current op.
Returns None if the program point is either invalid, or not pointing to a specific op
Sourcepub fn prev_operation(&self) -> Option<OperationRef>
pub fn prev_operation(&self) -> Option<OperationRef>
Returns the operation preceding Self::operation, relative to this program point.
If the current program point is in an orphaned operation, this will return the current op.
Returns None if the program point is either invalid, or not pointing to a specific op
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if this program point refers to a valid program point
Sourcepub fn cursor<'a, 'b: 'a, 'c: 'b>(
&'c self,
) -> Option<EntityProjection<'b, EntityListCursor<'a, Operation>>>
pub fn cursor<'a, 'b: 'a, 'c: 'b>( &'c self, ) -> Option<EntityProjection<'b, EntityListCursor<'a, Operation>>>
Obtain an immutable cursor in the block corresponding to this program point.
The resulting cursor can have as_pointer or get called on it to get the operation to
which this point is relative. The intuition around where the cursor is placed for a given
program point can be understood as answering the question of “where does the cursor need
to be, such that if I inserted an op at that cursor, that the insertion would be placed at
the referenced program point (semantically before or after an operation or block). The
specific rules are as follows:
- If “before” a block, the resulting cursor is the null cursor for the containing block, since an insertion at the null cursor will be placed at the start of the block.
- If “after” a block, the cursor is placed on the last operation in the block, as insertion will place the inserted op at the end of the block
- If “before” an operation, the cursor is placed on the operation immediately preceding
self, or a null cursor is returned. In both cases, an insertion at the returned cursor would be placed immediately beforeself - If “after” an operation, the cursor is placed on the operation in
self, so that insertion will place the inserted op immediately afterself.
NOTE: The block to which this program point refers will be borrowed for the lifetime of the returned EntityProjection.
Sourcepub fn cursor_mut<'a, 'b: 'a, 'c: 'b>(
&'c mut self,
) -> Option<EntityProjectionMut<'b, EntityListCursorMut<'a, Operation>>>
pub fn cursor_mut<'a, 'b: 'a, 'c: 'b>( &'c mut self, ) -> Option<EntityProjectionMut<'b, EntityListCursorMut<'a, Operation>>>
Same as Self::cursor, but obtains a mutable cursor instead.
NOTE: The block to which this program point refers will be borrowed mutably for the lifetime of the returned EntityProjectionMut.
Trait Implementations§
Source§impl Clone for ProgramPoint
impl Clone for ProgramPoint
Source§fn clone(&self) -> ProgramPoint
fn clone(&self) -> ProgramPoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ProgramPoint
Source§impl Debug for ProgramPoint
impl Debug for ProgramPoint
Source§impl Default for ProgramPoint
impl Default for ProgramPoint
Source§fn default() -> ProgramPoint
fn default() -> ProgramPoint
Source§impl Display for ProgramPoint
impl Display for ProgramPoint
impl Eq for ProgramPoint
Source§impl From<&Block> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to block
impl From<&Block> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to block
Source§impl From<&Operation> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to op
impl From<&Operation> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to op
Source§impl<T> From<EntityMut<'_, T>> for ProgramPoint
impl<T> From<EntityMut<'_, T>> for ProgramPoint
Source§impl<T> From<EntityRef<'_, T>> for ProgramPoint
impl<T> From<EntityRef<'_, T>> for ProgramPoint
Source§impl From<RawEntityRef<Block, IntrusiveLink>> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to block
impl From<RawEntityRef<Block, IntrusiveLink>> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to block
Source§impl From<RawEntityRef<Operation, IntrusiveLink>> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to op
impl From<RawEntityRef<Operation, IntrusiveLink>> for ProgramPoint
Construct a ProgramPoint referring to the point at entry to op
Source§fn from(op: OperationRef) -> Self
fn from(op: OperationRef) -> Self
Source§impl Hash for ProgramPoint
impl Hash for ProgramPoint
Source§impl PartialEq for ProgramPoint
impl PartialEq for ProgramPoint
Source§impl Spanned for ProgramPoint
impl Spanned for ProgramPoint
fn span(&self) -> SourceSpan
Auto Trait Implementations§
impl !RefUnwindSafe for ProgramPoint
impl !Send for ProgramPoint
impl !Sync for ProgramPoint
impl !UnwindSafe for ProgramPoint
impl Freeze for ProgramPoint
impl Unpin for ProgramPoint
impl UnsafeUnpin for ProgramPoint
Blanket Implementations§
impl<T> AttributeValue for Twhere
T: AsAny + CloneToUninit,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<From, To, Obj> DowncastFrom<From, Obj> for To
impl<From, To, Obj> DowncastFrom<From, Obj> for To
Source§impl<From, To> DowncastFromRef<From> for To
impl<From, To> DowncastFromRef<From> for To
Source§impl<From, To> DowncastRef<To> for From
impl<From, To> DowncastRef<To> for From
fn downcast_ref(&self) -> Option<&To>
fn downcast_mut(&mut self) -> Option<&mut To>
Source§impl<T> DynPartialEq for T
impl<T> DynPartialEq for T
default fn dyn_eq(&self, rhs: &dyn PartialEqable) -> bool
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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 moreimpl<Trait, T> Is<Trait> for T
impl<T, Trait> IsObjOf<T> for Trait
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
impl<T> Package for T
Source§impl<T> PartialEqable for T
impl<T> PartialEqable for T
Source§impl<T> PassTarget for Twhere
T: 'static,
impl<T> PassTarget for Twhere
T: 'static,
default fn target_name(_context: &Context) -> Option<OperationName>
default fn into_target( op: &RawEntityRef<Operation, IntrusiveLink>, ) -> EntityRef<'_, T>
default fn into_target_mut( op: &mut RawEntityRef<Operation, IntrusiveLink>, ) -> EntityMut<'_, T>
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<From, To, Obj> TryUpcastFrom<From, Obj> for To
impl<From, To, Obj> TryUpcastFrom<From, Obj> for To
Source§impl<From, To> TryUpcastFromRef<From> for To
impl<From, To> TryUpcastFromRef<From> for To
Source§impl<From, To> TryUpcastRef<To> for From
impl<From, To> TryUpcastRef<To> for From
Source§impl<From, To> UpcastFrom<From> for To
impl<From, To> UpcastFrom<From> for To
fn upcast_from_ref(from: &From) -> &To
fn upcast_from_mut(from: &mut From) -> &mut To
fn upcast_from(from: Box<From>) -> Box<To>
Source§impl<T, Trait> Verifier<Trait> for Twhere
Trait: ?Sized,
impl<T, Trait> Verifier<Trait> for Twhere
Trait: ?Sized,
Source§const VACUOUS: bool = const VACUOUS: bool = true;
const VACUOUS: bool = const VACUOUS: bool = true;
Verifier sets this flag to true when its implementation is vacuous,
i.e. it always succeeds and is not dependent on runtime context. Read moreSource§default fn should_verify(&self, _context: &Context) -> bool
default fn should_verify(&self, _context: &Context) -> bool
Source§default fn maybe_verify(&self, _context: &Context) -> Result<(), Report>
default fn maybe_verify(&self, _context: &Context) -> Result<(), Report>
true