Download node-graph/gcore/src/debug.rs from openfree/graphite2: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gcore/src/debug.rs
- Command line
-
hf download hf://spaces/openfree/graphite2/node-graph/gcore/src/debug.rs
-
curl -L -o debug.rs https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gcore/src/debug.rs
1.57 kB
| use crate::raster_types::{CPU, RasterDataTable}; | |
| use crate::vector::VectorDataTable; | |
| use crate::{Color, Ctx}; | |
| use glam::{DAffine2, DVec2}; | |
| fn log_to_console<T: std::fmt::Debug>(_: impl Ctx, value: T) -> T { | |
| // KEEP THIS `debug!()` - It acts as the output for the debug node itself | |
| log::debug!("{:#?}", value); | |
| value | |
| } | |
| /// Meant for debugging purposes, not general use. Returns the size of the input type in bytes. | |
| fn size_of(_: impl Ctx, ty: crate::Type) -> Option<usize> { | |
| ty.size() | |
| } | |
| /// Meant for debugging purposes, not general use. Wraps the input value in the Some variant of an Option. | |
| fn some<T>(_: impl Ctx, input: T) -> Option<T> { | |
| Some(input) | |
| } | |
| /// Meant for debugging purposes, not general use. Unwraps the input value from an Option, returning the default value if the input is None. | |
| fn unwrap<T: Default>(_: impl Ctx, input: Option<T>) -> T { | |
| input.unwrap_or_default() | |
| } | |
| /// Meant for debugging purposes, not general use. Clones the input value. | |
| fn clone<'i, T: Clone + 'i>(_: impl Ctx, value: &'i T) -> T { | |
| value.clone() | |
| } | |