Files
VoelinClient/crates/proto/ts-bookkeeping/build/properties.rs
T
Claude 7b6959c4cc vendor: import ReSpeak/tsclientlib@ee3bc6f
Unmodified copy of the tsclientlib workspace crates (MIT OR Apache-2.0)
with the tsdeclarations submodule (83cb8a9) flattened into plain files.
See crates/proto/UPSTREAM.md for the path mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-25 12:46:11 +00:00

44 lines
948 B
Rust

//! Access properties of a connection with the property structs from events.
use std::default::Default;
use std::fmt::Write;
use heck::*;
use t4rust_derive::Template;
use tsproto_structs::book::*;
use tsproto_structs::embrace;
#[derive(Template)]
#[TemplatePath = "build/Properties.tt"]
#[derive(Debug)]
pub struct Properties<'a>(&'a BookDeclarations);
impl Default for Properties<'static> {
fn default() -> Self { Properties(&DATA) }
}
fn get_ids(struc: &Struct) -> String {
let mut res = String::new();
for i in 0..struc.id.len() {
if !res.is_empty() {
res.push_str(", ");
}
let _ = write!(res, "s{}", i);
}
res
}
fn get_ids2(structs: &[Struct], struc: &Struct) -> String {
let mut res = String::new();
for (i, id) in struc.id.iter().enumerate() {
let p = id.find_property(structs);
if !res.is_empty() {
res.push_str(", ");
}
if p.type_s != "str" {
res.push('*');
}
let _ = write!(res, "s{}", i);
}
res
}