Struct evosim::blob::blob_builder::BlobBuilder
source · pub struct BlobBuilder<'a> {
commands: Commands<'a, 'a>,
nnvec: &'a mut Vec<GenericNN>,
blob_bundle: Entity,
pub blocks: Vec<BlobBlock>,
info: BlobInfo,
current_pos: Option<usize>,
}
Expand description
BlobBuilder, takes ownership fo commands and mut reference of nnvec.
Can use it to generate a physical blob with nn in any possible structures
Fields§
§commands: Commands<'a, 'a>
§nnvec: &'a mut Vec<GenericNN>
§blob_bundle: Entity
§blocks: Vec<BlobBlock>
§info: BlobInfo
§current_pos: Option<usize>
current position index in block vector
Implementations§
source§impl<'a> BlobBuilder<'a>
impl<'a> BlobBuilder<'a>
sourcepub fn from_commands(
commands: Commands<'a, 'a>,
nnvec: &'a mut Vec<GenericNN>
) -> Self
pub fn from_commands( commands: Commands<'a, 'a>, nnvec: &'a mut Vec<GenericNN> ) -> Self
BlobBuilder taks ownership of Commands, which means you can not use Commands anymore after using the BlobBuilder. To use commands, you need to preform it before creating BlobBuilder or just create another system.
To generate multiple blobs, or want to use BlobBuilder in loops,
please use clean()
so that there won’t be joints connects.
sourcepub fn clean(&mut self) -> &mut Self
pub fn clean(&mut self) -> &mut Self
Clean all the things inside BlobBuilder
Equvalent to drop the old builder and generate a new one
nnvec
will be kept
sourcepub fn update_geno(&mut self, geno: BlobGeno)
pub fn update_geno(&mut self, geno: BlobGeno)
send geno to blob so geno can be kept
sourcepub fn create_first<T: Bundle>(
&mut self,
phy_block_bundle: PhysiBlockBundle,
others: T
) -> Option<usize>
pub fn create_first<T: Bundle>( &mut self, phy_block_bundle: PhysiBlockBundle, others: T ) -> Option<usize>
create the first block and return the nn_id of it
sourcepub fn add_to_left<T: Bundle>(
&mut self,
dx: f32,
dy: f32,
motor_pos: Option<f32>,
motor_limits: Option<[f32; 2]>,
others: T
) -> Option<usize>
pub fn add_to_left<T: Bundle>( &mut self, dx: f32, dy: f32, motor_pos: Option<f32>, motor_limits: Option<[f32; 2]>, others: T ) -> Option<usize>
add a new block to the left of the current block and move the current position to that block
sourcepub fn add_to_right<T: Bundle>(
&mut self,
dx: f32,
dy: f32,
motor_pos: Option<f32>,
motor_limits: Option<[f32; 2]>,
others: T
) -> Option<usize>
pub fn add_to_right<T: Bundle>( &mut self, dx: f32, dy: f32, motor_pos: Option<f32>, motor_limits: Option<[f32; 2]>, others: T ) -> Option<usize>
add a new block to the right of the current block and move the current position to that block
sourcepub fn add_to_top<T: Bundle>(
&mut self,
dx: f32,
dy: f32,
motor_pos: Option<f32>,
motor_limits: Option<[f32; 2]>,
others: T
) -> Option<usize>
pub fn add_to_top<T: Bundle>( &mut self, dx: f32, dy: f32, motor_pos: Option<f32>, motor_limits: Option<[f32; 2]>, others: T ) -> Option<usize>
add a new block to the top of the current block and move the current position to that block
sourcepub fn add_to_bottom<T: Bundle>(
&mut self,
dx: f32,
dy: f32,
motor_pos: Option<f32>,
motor_limits: Option<[f32; 2]>,
others: T
) -> Option<usize>
pub fn add_to_bottom<T: Bundle>( &mut self, dx: f32, dy: f32, motor_pos: Option<f32>, motor_limits: Option<[f32; 2]>, others: T ) -> Option<usize>
add a new block to the bottom of the current block and move the current position to that block
sourcefn update_info(&mut self)
fn update_info(&mut self)
update info inside the blob_bundle
Auto Trait Implementations§
impl<'a> RefUnwindSafe for BlobBuilder<'a>
impl<'a> Send for BlobBuilder<'a>
impl<'a> Sync for BlobBuilder<'a>
impl<'a> Unpin for BlobBuilder<'a>
impl<'a> !UnwindSafe for BlobBuilder<'a>
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.