Files
Graphite/node-graph/gcore/src/logic.rs
Yuri Astrakhan 3d4e3a74e5 A few minor lints and docs (#1436)
* A few minor lints and docs

* Added required packages to compile on Debian-style linux
* Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline)
* a few spelling mistakes

* fix fmt
2023-10-18 23:33:10 -07:00

45 lines
802 B
Rust

use crate::Node;
pub struct LogToConsoleNode;
#[node_macro::node_fn(LogToConsoleNode)]
fn log_to_console<T: core::fmt::Debug>(value: T) -> T {
#[cfg(not(target_arch = "spirv"))]
debug!("{value:#?}");
value
}
pub struct LogicOrNode<Second> {
second: Second,
}
#[node_macro::node_fn(LogicOrNode)]
fn logic_or(first: bool, second: bool) -> bool {
first || second
}
pub struct LogicAndNode<Second> {
second: Second,
}
#[node_macro::node_fn(LogicAndNode)]
fn logic_and(first: bool, second: bool) -> bool {
first && second
}
pub struct LogicXorNode<Second> {
second: Second,
}
#[node_macro::node_fn(LogicXorNode)]
fn logic_xor(first: bool, second: bool) -> bool {
first ^ second
}
pub struct LogicNotNode;
#[node_macro::node_fn(LogicNotNode)]
fn logic_not(first: bool) -> bool {
!first
}