Skip to main content

BlockWrapper

Struct BlockWrapper 

Source
pub struct BlockWrapper { /* private fields */ }
Expand description

This wraps a Scratch block

It stores the unique Id of the block Scratch has assigned to it, the Id of the next block (especially important for statements) and the parent block (parent is not actively used in the application).

parent is not the defined to be the previous block (next and parent don’t form a double-linked-list) but it can be the next-outer-block in the hierarchy. See here for details

Implementations§

Source§

impl BlockWrapper

Auto-generated by derive_getters::Getters.

Source

pub fn id(&self) -> &Id

The unique id of this block, alphanumeric and special characters are used

Source

pub fn inner(&self) -> &BlockKind

The BlockKind contains specific information for this kind of block

Source

pub fn next(&self) -> &Option<Id>

An optional id to the next block following this

Source

pub fn parent(&self) -> &Option<Id>

parent is not actively used in the application

parent is not the defined to be the previous block (next and parent don’t form a double-linked-list) but it can be the next-outer-block in the hierarchy. See here for details

Source

pub fn shadow(&self) -> &bool

not needed for the application, but it is present in the file so it’s parsed

Source

pub fn top_level_pos(&self) -> &Option<Position>

topLevel/x/y is the position of blocks, if they are top-level

If and (as it seems) only if the property topLevel is set to true, the two properties x and y are also present.

They then form the position of the block on a grid.

Trait Implementations§

Source§

impl Debug for BlockWrapper

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BlockWrapper

Source§

fn eq(&self, other: &BlockWrapper) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlockWrapper

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.