This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "scout" | |
| version = "0.1.0" | |
| edition = "2024" | |
| [dependencies] | |
| mimalloc = "0.1.43" | |
| re_crash_handler = { version = "0.22.1", features = ["analytics"] } | |
| re_grpc_server = "0.22.1" | |
| re_sdk_comms = { version = "0.22.1", features = ["server"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vcpkg integrate install | |
| vcpkg.exe install openssl:x64-windows-static-md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::any::Any; | |
| fn main() { | |
| // Create boxes containing different types, boxed as Any | |
| let integer_box: Box<dyn Any> = Box::new(42); | |
| let string_box: Box<dyn Any> = Box::new(String::from("Hello")); | |
| let float_box: Box<dyn Any> = Box::new(3.14f64); | |
| // Demonstrate successful downcasting | |
| println!("Downcasting examples:"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::collections::{HashMap, VecDeque}; | |
| #[derive(Debug, Clone, PartialEq)] | |
| pub enum Message { | |
| Text(String), | |
| Number(i64), | |
| Binary(Vec<u8>), | |
| Batch(Vec<Message>), | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[macro_export] | |
| macro_rules! world { | |
| ( | |
| $world:ident { | |
| components { | |
| $($name:ident: $type:ty => $mask:ident),* $(,)? | |
| }$(,)? | |
| $resources:ident { | |
| $($resource_name:ident: $resource_type:ty),* $(,)? | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl_world! { | |
| positions: Position => POSITION = 0, | |
| velocities: Velocity => VELOCITY = 1, | |
| gravities: Gravity => GRAVITY = 2, | |
| healths: Health => HEALTH = 3, | |
| damages: Damage => DAMAGE = 4, | |
| } | |
| pub fn main() { | |
| let mut world = World::default(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![no_std] | |
| pub struct CircularBuffer<T, const N: usize> { | |
| buffer: [T; N], | |
| read_idx: usize, | |
| write_idx: usize, | |
| is_full: bool, | |
| } | |
| impl<T: Copy + Default, const N: usize> CircularBuffer<T, N> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::any::Any; | |
| use std::collections::HashMap; | |
| use std::marker::PhantomData; | |
| // Generic handle type | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | |
| pub struct Handle<T> { | |
| id: usize, | |
| _phantom: PhantomData<T>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use regex::Regex; | |
| use std::collections::HashMap; | |
| #[derive(Debug)] | |
| struct CaptureSpec { | |
| name: String, | |
| position: usize, | |
| regex: Option<String>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use serde_json::Value; | |
| use std::collections::HashMap; | |
| pub fn expand_json_template(template: &str, tokens: &HashMap<String, String>) -> Option<String> { | |
| let substituted = substitute_tokens(template, tokens); | |
| match serde_json::from_str::<Value>(&substituted) { | |
| Ok(value) => serde_json::to_string_pretty(&value).ok(), | |
| Err(e) => { | |
| println!("Error parsing JSON after substitution: {}", e); | |
| None |