pub struct Component { /* private fields */ }
Expand description

Components are objects that can contain Functions, Data Variables, and other Components.

They can be queried for information about the items contained within them.

Components have a Guid, which persistent across saves and loads of the database, and should be used for retrieving components when such is required and a reference to the Component cannot be held.

Implementations§

source§

impl Component

source

pub fn guid(&self) -> BnString

source

pub fn add_function(&self, func: &Function) -> bool

Add function to this component.

source

pub fn contains_function(&self, func: &Function) -> bool

Check whether this component contains a function.

source

pub fn remove_function(&self, func: &Function) -> bool

Remove function from this component.

source

pub fn add_component(&self, component: &Component) -> bool

Move component to this component. This will remove it from the old parent.

source

pub fn contains_component(&self, component: &Component) -> bool

Check whether this component contains a component.

source

pub fn remove_component(&self, component: &Component) -> bool

Remove a component from the current component, moving it to the root.

This function has no effect when used from the root component. Use BinaryView.remove_component to Remove a component from the tree entirely.

source

pub fn add_data_variable(&self, data_variable: &DataVariable) -> bool

Add data variable to this component.

source

pub fn contains_data_variable(&self, data_variable: &DataVariable) -> bool

Check whether this component contains a data variable.

source

pub fn remove_data_variable(&self, data_variable: &DataVariable) -> bool

Remove data variable from this component.

source

pub fn display_name(&self) -> BnString

Original name of the component

source

pub fn name(&self) -> BnString

Original name set for this component :note: The .display_name property should be used for bv.get_component_by_path() lookups. This can differ from the .display_name property if one of its sibling components has the same .original_name; In that case, .name will be an automatically generated unique name (e.g. “MyComponentName (1)”) while .original_name will remain what was originally set (e.g. “MyComponentName”) If this component has a duplicate name and is moved to a component where none of its siblings share its name, .name will return the original “MyComponentName”

source

pub fn set_name<S: BnStrCompatible>(&self, name: S)

source

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

The component that contains this component, if it exists.

source

pub fn view(&self) -> Option<Ref<BinaryView>>

source

pub fn components(&self) -> Array<Component>

Is an iterator for all Components contained within this Component

source

pub fn functions(&self) -> Array<Function>

List of all Functions contained within this Component

source

pub fn data_variables(&self) -> Array<DataVariable>

List of all Data Variables contained within this Component

source

pub fn get_referenced_data_variables( &self, recursive: bool ) -> Array<DataVariable>

Get data variables referenced by this component

  • recursive - Get all DataVariables referenced by this component and subcomponents.
source

pub fn get_referenced_types( &self, recursive: bool ) -> Array<ComponentReferencedTypes>

Get Types referenced by this component

  • recursive - Get all Types referenced by this component and subcomponents.
source

pub fn remove_all_functions(&self)

source

pub fn add_all_members_from(&self, component: &Component)

Trait Implementations§

source§

impl Clone for Component

source§

fn clone(&self) -> Self

Returns a copy 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 CoreArrayProvider for Component

§

type Raw = *mut BNComponent

§

type Context = ()

§

type Wrapped<'a> = &'a Component

source§

impl Drop for Component

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl IntoComponentGuid for &Component

source§

impl PartialEq for Component

source§

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

This method tests for self and other values to be equal, and is used by ==.
source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Component

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

§

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>,

§

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>,

§

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.