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
impl Component
pub fn guid(&self) -> String
Sourcepub fn add_function(&self, func: &Function) -> bool
pub fn add_function(&self, func: &Function) -> bool
Add function to this component.
Sourcepub fn contains_function(&self, func: &Function) -> bool
pub fn contains_function(&self, func: &Function) -> bool
Check whether this component contains a function.
Sourcepub fn remove_function(&self, func: &Function) -> bool
pub fn remove_function(&self, func: &Function) -> bool
Remove function from this component.
Sourcepub fn add_component(&self, component: &Component) -> bool
pub fn add_component(&self, component: &Component) -> bool
Move component to this component. This will remove it from the old parent.
Sourcepub fn contains_component(&self, component: &Component) -> bool
pub fn contains_component(&self, component: &Component) -> bool
Check whether this component contains a component.
Sourcepub fn remove_component(&self, component: &Component) -> bool
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.
Sourcepub fn add_data_variable(&self, data_variable: &DataVariable) -> bool
pub fn add_data_variable(&self, data_variable: &DataVariable) -> bool
Add data variable to this component.
Sourcepub fn contains_data_variable(&self, data_variable: &DataVariable) -> bool
pub fn contains_data_variable(&self, data_variable: &DataVariable) -> bool
Check whether this component contains a data variable.
Sourcepub fn remove_data_variable(&self, data_variable: &DataVariable) -> bool
pub fn remove_data_variable(&self, data_variable: &DataVariable) -> bool
Remove data variable from this component.
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Original name of the component
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
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”
pub fn set_name(&self, name: &str)
Sourcepub fn parent(&self) -> Option<Ref<Component>>
pub fn parent(&self) -> Option<Ref<Component>>
The component that contains this component, if it exists.
pub fn view(&self) -> Option<Ref<BinaryView>>
Sourcepub fn components(&self) -> Array<Component>
pub fn components(&self) -> Array<Component>
Is an iterator for all Components contained within this Component
Sourcepub fn functions(&self) -> Array<Function>
pub fn functions(&self) -> Array<Function>
List of all Functions contained within this Component
Sourcepub fn data_variables(&self) -> Array<DataVariable>
pub fn data_variables(&self) -> Array<DataVariable>
List of all Data Variables contained within this Component
Sourcepub fn referenced_data_variables(&self, recursive: bool) -> Array<DataVariable>
pub fn 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.
Sourcepub fn referenced_types(
&self,
recursive: bool,
) -> Array<ComponentReferencedType>
pub fn referenced_types( &self, recursive: bool, ) -> Array<ComponentReferencedType>
Get Types referenced by this component
recursive- Get all Types referenced by this component and subcomponents.
pub fn remove_all_functions(&self)
pub fn add_all_members_from(&self, component: &Component)
Trait Implementations§
Source§impl CoreArrayProvider for Component
impl CoreArrayProvider for Component
Source§impl ToOwned for Component
impl ToOwned for Component
impl Eq for Component
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl !Send for Component
impl !Sync for Component
impl Unpin for Component
impl UnwindSafe for Component
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
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