Skip to main content

Block

Struct Block 

Source
pub struct Block {
Show 34 fields pub block_type: String, pub name: String, pub sid: Option<String>, pub tag_name: String, pub position: Option<String>, pub zorder: Option<String>, pub commented: bool, pub name_location: NameLocation, pub is_matlab_function: bool, pub value: Option<String>, pub value_kind: ValueKind, pub value_rows: Option<u32>, pub value_cols: Option<u32>, pub properties: IndexMap<String, String>, pub ref_properties: BTreeSet<String>, pub port_counts: Option<PortCounts>, pub ports: Vec<Port>, pub subsystem: Option<Box<System>>, pub system_ref: Option<String>, pub c_function: Option<CFunctionCode>, pub instance_data: Option<InstanceData>, pub link_data: Option<LinkData>, pub mask: Option<Mask>, pub annotations: Vec<Annotation>, pub background_color: Option<String>, pub show_name: Option<bool>, pub font_size: Option<u32>, pub font_weight: Option<String>, pub mask_display_text: Option<String>, pub current_setting: Option<String>, pub block_mirror: Option<bool>, pub library_source: Option<String>, pub library_block_path: Option<String>, pub child_order: Vec<BlockChildKind>,
}
Expand description

A Simulink block or reference.

The properties map preserves the original insertion order of <P> elements and stores all <P> values (including Position, ZOrder, etc.) so that system XML files can be exactly regenerated.

Properties that use the XML Ref attribute instead of text content are tracked in ref_properties.

Fields§

§block_type: String

Block type (e.g. “Gain”, “SubSystem”, “Reference”).

§name: String§sid: Option<String>§tag_name: String

XML element tag name: "Block" or "Reference".

§position: Option<String>

Convenience: parsed Position string (also stored in properties).

§zorder: Option<String>

Convenience: parsed ZOrder string (also stored in properties).

§commented: bool§name_location: NameLocation

Location of the block name label (defaults to Bottom if not specified).

§is_matlab_function: bool

True if this block is a Stateflow MATLAB Function block.

§value: Option<String>

Optional block value as text (e.g., for Constant blocks).

§value_kind: ValueKind

Parsed value kind (scalar/vector/matrix).

§value_rows: Option<u32>§value_cols: Option<u32>§properties: IndexMap<String, String>

Ordered map of all <P> element key-value pairs, including Position and ZOrder in their original order.

§ref_properties: BTreeSet<String>

Names of properties whose XML value is stored in a Ref attribute rather than as text content (e.g., LibrarySourceProduct).

§port_counts: Option<PortCounts>

PortCounts element (<PortCounts in="…" out="…"/>). None means no <PortCounts> element in the XML.

§ports: Vec<Port>§subsystem: Option<Box<System>>

Resolved nested system (subsystem content).

§system_ref: Option<String>

If the <System> child used a Ref attribute (e.g., Ref="system_18"), this field stores that reference name for round-trip output.

§c_function: Option<CFunctionCode>

Present when this is a CFunction block.

§instance_data: Option<InstanceData>

Optional per-instance data.

§link_data: Option<LinkData>

Optional link data (preserves pass-through dialog parameters).

§mask: Option<Mask>

Optional Simulink mask.

§annotations: Vec<Annotation>

Annotations attached to the block.

§background_color: Option<String>

Convenience: parsed background color.

§show_name: Option<bool>

Convenience: parsed show-name flag.

§font_size: Option<u32>

Convenience: parsed font size.

§font_weight: Option<String>

Convenience: parsed font weight.

§mask_display_text: Option<String>

Evaluated display text from mask’s Display script.

§current_setting: Option<String>

Optional current setting for blocks like ManualSwitch.

§block_mirror: Option<bool>

Whether the block is mirrored.

§library_source: Option<String>

Library source name this block was copied from.

§library_block_path: Option<String>

Full library block path.

§child_order: Vec<BlockChildKind>

Order of child XML elements inside this block, used for round-trip XML generation. When empty, a default order is used.

Implementations§

Source§

impl Block

Source

pub fn get_full_path(&self, root: &System) -> Option<String>

Returns the full path to this block as <subsystem>/<block name>.

Trait Implementations§

Source§

impl Clone for Block

Source§

fn clone(&self) -> Block

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Block

Source§

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

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

impl<'de> Deserialize<'de> for Block

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Block

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Block

§

impl RefUnwindSafe for Block

§

impl Send for Block

§

impl Sync for Block

§

impl Unpin for Block

§

impl UnwindSafe for Block

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,