Struct bevy_serial::SerialPlugin
source · pub struct SerialPlugin {
pub settings: Vec<SerialSetting>,
}Expand description
Plugin that can be added to Bevy
Fields§
§settings: Vec<SerialSetting>Implementations§
source§impl SerialPlugin
impl SerialPlugin
sourcepub fn new(port_name: &str, baud_rate: u32) -> Self
pub fn new(port_name: &str, baud_rate: u32) -> Self
Examples found in repository?
examples/simple.rs (line 14)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
App::new()
.add_plugins(MinimalPlugins)
// simply specify port name and baud rate for `SerialPlugin`
.add_plugins(SerialPlugin::new(SERIAL_PORT, 115200))
// to write data to serial port periodically (every 1 second)
.insert_resource(SerialWriteTimer(Timer::from_seconds(
1.0,
TimerMode::Repeating,
)))
// reading and writing from/to serial port is achieved via bevy's event system
.add_systems(Update, read_serial)
.add_systems(Update, write_serial)
.run();
}Trait Implementations§
source§impl Clone for SerialPlugin
impl Clone for SerialPlugin
source§fn clone(&self) -> SerialPlugin
fn clone(&self) -> SerialPlugin
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for SerialPlugin
impl Debug for SerialPlugin
source§impl PartialEq for SerialPlugin
impl PartialEq for SerialPlugin
source§fn eq(&self, other: &SerialPlugin) -> bool
fn eq(&self, other: &SerialPlugin) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Plugin for SerialPlugin
impl Plugin for SerialPlugin
§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
Has the plugin finished it’s setup? This can be useful for plugins that needs something
asynchronous to happen before they can finish their setup, like renderer initialization.
Once the plugin is ready,
finish should be called.§fn finish(&self, _app: &mut App)
fn finish(&self, _app: &mut App)
Finish adding this plugin to the [
App], once all plugins registered are ready. This can
be useful for plugins that depends on another plugin asynchronous setup, like the renderer.§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Runs after all plugins are built and finished, but before the app schedule is executed.
This can be useful if you have some resource that other plugins need during their build step,
but after build you want to remove it and send it to another thread.
impl Eq for SerialPlugin
impl StructuralEq for SerialPlugin
impl StructuralPartialEq for SerialPlugin
Auto Trait Implementations§
impl RefUnwindSafe for SerialPlugin
impl Send for SerialPlugin
impl Sync for SerialPlugin
impl Unpin for SerialPlugin
impl UnwindSafe for SerialPlugin
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
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)
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.