pub struct NodePlugin { /* private fields */ }Implementations§
Source§impl NodePlugin
impl NodePlugin
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/extension.rs (line 31)
7fn main() {
8 Application::new().run(|cx| {
9 let mut graph = Graph::new();
10
11 graph
12 .create_node("number")
13 .position(100.0, 100.0)
14 .size(300.0, 150.0)
15 .output()
16 .build(&mut graph);
17
18 graph
19 .create_node("")
20 .position(300.0, 400.0)
21 .input()
22 .build(&mut graph);
23
24 cx.open_window(WindowOptions::default(), |_, cx| {
25 cx.new(|fc| {
26 let mut flow = FlowCanvas::new(graph, fc)
27 .plugin(SelectionPlugin::new())
28 .plugin(NodeInteractionPlugin::new())
29 .plugin(ViewportPlugin::new())
30 .plugin(Background::new())
31 .plugin(NodePlugin::new().register_node("number", NumberNode {}));
32 flow.init_plugins();
33 flow
34 })
35 })
36 .unwrap();
37 });
38}More examples
examples/bench.rs (line 26)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 for j in 0..100 {
9 for i in 0..100 {
10 graph
11 .create_node("")
12 .position(200.0 * i as f32, 200.0 * j as f32)
13 .input()
14 .output()
15 .build(&mut graph);
16 }
17 }
18
19 cx.open_window(WindowOptions::default(), |_, cx| {
20 cx.new(|fc| {
21 let mut flow = FlowCanvas::new(graph, fc)
22 .plugin(SelectionPlugin::new())
23 .plugin(NodeInteractionPlugin::new())
24 .plugin(ViewportPlugin::new())
25 .plugin(Background::new())
26 .plugin(NodePlugin::new())
27 .plugin(PortInteractionPlugin::new())
28 .plugin(EdgePlugin::new())
29 .plugin(DeletePlugin::new())
30 .plugin(HistoryPlugin::new());
31 flow.init_plugins();
32 flow
33 })
34 })
35 .unwrap();
36 });
37}examples/basic.rs (line 35)
4fn main() {
5 Application::new().run(|cx| {
6 let mut graph = Graph::new();
7
8 graph
9 .create_node("")
10 .position(100.0, 100.0)
11 .output()
12 .build(&mut graph);
13
14 graph
15 .create_node("")
16 .position(300.0, 400.0)
17 .input()
18 .output()
19 .build(&mut graph);
20
21 graph
22 .create_node("")
23 .position(500.0, 500.0)
24 .input()
25 .output()
26 .build(&mut graph);
27
28 cx.open_window(WindowOptions::default(), |_, cx| {
29 cx.new(|fc| {
30 let mut flow = FlowCanvas::new(graph, fc)
31 .plugin(SelectionPlugin::new())
32 .plugin(NodeInteractionPlugin::new())
33 .plugin(ViewportPlugin::new())
34 .plugin(Background::new())
35 .plugin(NodePlugin::new())
36 .plugin(PortInteractionPlugin::new())
37 .plugin(EdgePlugin::new())
38 .plugin(DeletePlugin::new())
39 .plugin(HistoryPlugin::new());
40 flow.init_plugins();
41 flow
42 })
43 })
44 .unwrap();
45 });
46}Sourcepub fn register_node<R>(self, name: impl Into<String>, renderer: R) -> Selfwhere
R: NodeRenderer + 'static,
pub fn register_node<R>(self, name: impl Into<String>, renderer: R) -> Selfwhere
R: NodeRenderer + 'static,
Examples found in repository?
examples/extension.rs (line 31)
7fn main() {
8 Application::new().run(|cx| {
9 let mut graph = Graph::new();
10
11 graph
12 .create_node("number")
13 .position(100.0, 100.0)
14 .size(300.0, 150.0)
15 .output()
16 .build(&mut graph);
17
18 graph
19 .create_node("")
20 .position(300.0, 400.0)
21 .input()
22 .build(&mut graph);
23
24 cx.open_window(WindowOptions::default(), |_, cx| {
25 cx.new(|fc| {
26 let mut flow = FlowCanvas::new(graph, fc)
27 .plugin(SelectionPlugin::new())
28 .plugin(NodeInteractionPlugin::new())
29 .plugin(ViewportPlugin::new())
30 .plugin(Background::new())
31 .plugin(NodePlugin::new().register_node("number", NumberNode {}));
32 flow.init_plugins();
33 flow
34 })
35 })
36 .unwrap();
37 });
38}Trait Implementations§
Source§impl Plugin for NodePlugin
impl Plugin for NodePlugin
fn name(&self) -> &'static str
fn setup(&mut self, _ctx: &mut InitPluginContext<'_>)
fn on_event( &mut self, _event: &FlowEvent, _context: &mut PluginContext<'_>, ) -> EventResult
fn priority(&self) -> i32
fn render_layer(&self) -> RenderLayer
fn render(&mut self, ctx: &mut RenderContext<'_>) -> Option<AnyElement>
Auto Trait Implementations§
impl Freeze for NodePlugin
impl !RefUnwindSafe for NodePlugin
impl Send for NodePlugin
impl Sync for NodePlugin
impl Unpin for NodePlugin
impl UnsafeUnpin for NodePlugin
impl !UnwindSafe for NodePlugin
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
Converts
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>
Converts
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