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>

source

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.

source

pub fn set_color(&mut self, color: Color) -> &mut Self

set color for blob

source

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

source

pub fn update_geno(&mut self, geno: BlobGeno)

send geno to blob so geno can be kept

source

pub fn left(&mut self) -> &mut Self

move one step left from the current position

source

pub fn right(&mut self) -> &mut Self

move one step right from the current position

source

pub fn top(&mut self) -> &mut Self

move one step up from the current position

source

pub fn bottom(&mut self) -> &mut Self

move one step down from the current position

source

pub fn reset(&mut self) -> &mut Self

reset the current position to the first block

source

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

source

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

source

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

source

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

source

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

source

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§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

Return the T [ShaderType] for self. When used in [AsBindGroup] derives, it is safe to assume that all images in self exist.
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

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

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,