repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/graph/graph_builder.rs
libakaza/src/graph/graph_builder.rs
use std::collections::btree_map::BTreeMap; use std::collections::HashSet; use std::rc::Rc; use std::sync::{Arc, Mutex}; use kelp::{hira2kata, ConvOption}; use log::trace; use regex::Regex; use crate::graph::lattice_graph::LatticeGraph; use crate::graph::segmenter::SegmentationResult; use crate::graph::word_node::Word...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/graph/candidate.rs
libakaza/src/graph/candidate.rs
use std::cmp::Ordering; use crate::kansuji::int2kanji; #[allow(unused_imports)] use chrono::{DateTime, Local, TimeZone}; #[derive(Debug, Clone, PartialEq)] pub struct Candidate { pub surface: String, pub yomi: String, pub cost: f32, /// ่ค‡ๅˆ่ชžใ‹? ่ค‡ๅˆ่ชžใ ใฃใŸใ‚‰ใ€true ใซใชใ‚‹ใฎใงใ€ใใฎๅ ดๅˆใฏๅญฆ็ฟ’ๆ™‚ใซใƒฆใƒผใ‚ถใƒผ่พžๆ›ธใซ็™ป้Œฒใ™ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚‹ใ€‚ pub compo...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/graph/mod.rs
libakaza/src/graph/mod.rs
pub mod candidate; pub mod graph_builder; pub mod graph_resolver; pub mod lattice_graph; pub mod segmenter; pub mod word_node;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/graph/lattice_graph.rs
libakaza/src/graph/lattice_graph.rs
use std::collections::btree_map::BTreeMap; use std::fmt::{Debug, Formatter}; use std::rc::Rc; use std::sync::{Arc, Mutex}; use log::{error, info, trace}; use crate::graph::word_node::WordNode; use crate::lm::base::{SystemBigramLM, SystemUnigramLM}; use crate::user_side_data::user_data::UserData; // ่€ƒใˆใ‚‰ใ‚Œใ‚‹ๅ˜่ชžใฎๅˆ—ๅ…จใฆใ‚’ๅซใ‚€ใ‚ˆใ†ใช...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/graph/word_node.rs
libakaza/src/graph/word_node.rs
use std::fmt::{Display, Formatter}; use std::hash::{Hash, Hasher}; #[derive(Debug, Clone)] pub struct WordNode { pub start_pos: i32, /// ่กจๅฑคใ€‚ pub surface: String, /// ่ชญใฟไปฎๅ pub yomi: String, pub cost: f32, pub word_id_and_score: Option<(i32, f32)>, pub auto_generated: bool, } impl Hash f...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/graph/graph_resolver.rs
libakaza/src/graph/graph_resolver.rs
use std::cmp::Ordering; use std::collections::{BinaryHeap, HashMap}; use anyhow::Context; use log::{info, trace}; use crate::graph::candidate::Candidate; use crate::graph::lattice_graph::LatticeGraph; use crate::graph::word_node::WordNode; use crate::lm::base::{SystemBigramLM, SystemUnigramLM}; /** * Segmenter ใซใ‚ˆใ‚Šๅˆ†...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_trie/base.rs
libakaza/src/kana_trie/base.rs
pub trait KanaTrie { fn common_prefix_search(&self, query: &str) -> Vec<String>; }
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_trie/cedarwood_kana_trie.rs
libakaza/src/kana_trie/cedarwood_kana_trie.rs
use cedarwood::Cedar; use log::debug; use crate::kana_trie::base::KanaTrie; pub struct CedarwoodKanaTrie { cedar: Cedar, words: Vec<String>, } impl Default for CedarwoodKanaTrie { fn default() -> Self { let cedar = Cedar::new(); CedarwoodKanaTrie { cedar, words: Ve...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_trie/mod.rs
libakaza/src/kana_trie/mod.rs
/* * ๅ…ฑ้€šๆŽฅ้ ญ่พžๆคœ็ดขใซๅˆฉ็”จใ™ใ‚‹ใƒˆใƒฉใ‚คๆง‹้€ ใ€‚ * ไฝ•ใ‚’ๅˆฉ็”จใ™ใ‚‹ใ‹ใ‚’ๅ…ฅใ‚Œๆ›ฟใˆใ‚‰ใ‚Œใ‚‹ใ‚ˆใ†ใซใ—ใ‚ˆใ†ใ‹ใชใ€ใจใ€‚ */ pub mod base; pub mod cedarwood_kana_trie;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_kanji/base.rs
libakaza/src/kana_kanji/base.rs
pub trait KanaKanjiDict { fn get(&self, kana: &str) -> Option<Vec<String>>; }
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_kanji/marisa_kana_kanji_dict.rs
libakaza/src/kana_kanji/marisa_kana_kanji_dict.rs
use std::collections::HashMap; use log::trace; use marisa_sys::{Keyset, Marisa}; use crate::kana_kanji::base::KanaKanjiDict; #[derive(Default)] pub struct MarisaKanaKanjiDict { marisa: Marisa, } impl MarisaKanaKanjiDict { pub(crate) fn build_with_cache( dict: HashMap<String, Vec<String>>, c...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_kanji/hashmap_vec.rs
libakaza/src/kana_kanji/hashmap_vec.rs
use std::collections::HashMap; use crate::kana_kanji::base::KanaKanjiDict; #[derive(Default)] pub struct HashmapVecKanaKanjiDict { map: HashMap<String, Vec<String>>, } impl HashmapVecKanaKanjiDict { pub fn new(map: HashMap<String, Vec<String>>) -> Self { HashmapVecKanaKanjiDict { map } } } impl ...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/kana_kanji/mod.rs
libakaza/src/kana_kanji/mod.rs
pub mod base; pub mod hashmap_vec; pub mod marisa_kana_kanji_dict;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/user_side_data/bigram_user_stats.rs
libakaza/src/user_side_data/bigram_user_stats.rs
use std::collections::HashMap; use crate::cost::calc_cost; use crate::graph::candidate::Candidate; #[derive(Default)] pub(crate) struct BiGramUserStats { /// ใƒฆใƒ‹ใƒผใ‚ฏๅ˜่ชžๆ•ฐ unique_words: u32, // C /// ็ทๅ˜่ชžๅ‡บ็พๆ•ฐ total_words: u32, // V /// ใใฎๅ˜่ชžใฎๅ‡บ็พ้ ปๅบฆใ€‚ใ€Œๆผขๅญ—/ๆผขๅญ—ใ€ใŒใ‚ญใƒผใ€‚ pub(crate) word_count: HashMap<Strin...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/user_side_data/user_data.rs
libakaza/src/user_side_data/user_data.rs
use std::collections::HashMap; use std::path::Path; use std::sync::{Arc, Mutex}; use std::time::SystemTime; use anyhow::Result; use encoding_rs::UTF_8; use log::{info, warn}; use crate::dict::skk::read::read_skkdict; use crate::dict::skk::write::write_skk_dict; use crate::graph::candidate::Candidate; use crate::graph...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/user_side_data/user_stats_utils.rs
libakaza/src/user_side_data/user_stats_utils.rs
use anyhow::{Context, Result}; use std::collections::HashMap; use std::fs; use std::fs::{File, OpenOptions}; use std::io::{BufRead, BufReader, Write}; use std::os::unix::fs::OpenOptionsExt; pub(crate) fn read_user_stats_file(path: &String) -> Result<Vec<(String, u32)>> { let file = File::open(path)?; let mut ...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/user_side_data/mod.rs
libakaza/src/user_side_data/mod.rs
mod bigram_user_stats; mod unigram_user_stats; // ่ชฟๆ•ดใ‚ใ‚“ใฉใใ•ใ„ใฎใงใ„ใฃใŸใ‚“ใ‚ชใƒ•ใ€‚ pub mod user_data; mod user_stats_utils;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/user_side_data/unigram_user_stats.rs
libakaza/src/user_side_data/unigram_user_stats.rs
use std::collections::HashMap; use crate::cost::calc_cost; use crate::graph::candidate::Candidate; #[derive(Default)] pub(crate) struct UniGramUserStats { /// ใƒฆใƒ‹ใƒผใ‚ฏๅ˜่ชžๆ•ฐ unique_words: u32, // C /// ็ทๅ˜่ชžๅ‡บ็พๆ•ฐ total_words: u32, // V /// ใใฎๅ˜่ชžใฎๅ‡บ็พ้ ปๅบฆใ€‚ใ€Œๆผขๅญ—/ใ‹ใชใ€ใŒใ‚ญใƒผใ€‚ pub(crate) word_count: HashMap<Stri...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/system_bigram.rs
libakaza/src/lm/system_bigram.rs
use std::collections::HashMap; use anyhow::{bail, Result}; use half::f16; use log::info; use marisa_sys::{Keyset, Marisa}; use crate::lm::base::SystemBigramLM; use crate::search_result::SearchResult; /* {word1 ID} # 3 bytes {word2 ID} # 3 bytes packed float # score: 4 bytes */ const DEFAULT_COST_KE...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/base.rs
libakaza/src/lm/base.rs
use std::collections::HashMap; pub trait SystemBigramLM { fn get_default_edge_cost(&self) -> f32; fn get_edge_cost(&self, word_id1: i32, word_id2: i32) -> Option<f32>; fn as_hash_map(&self) -> HashMap<(i32, i32), f32>; } pub trait SystemUnigramLM { fn get_cost(&self, wordcnt: u32) -> f32; fn find...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/system_unigram_lm.rs
libakaza/src/lm/system_unigram_lm.rs
use std::collections::HashMap; use anyhow::{bail, Result}; use log::info; use marisa_sys::{Keyset, Marisa}; use crate::cost::calc_cost; use crate::lm::base::SystemUnigramLM; /* {word} # in utf-8 0xff # marker packed ID # 3 bytes(24bit). ๆœ€ๅคง่ชžๅฝ™: 8,388,608(2**24/2) packed float # score: 4 bytes */ c...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/mod.rs
libakaza/src/lm/mod.rs
pub mod base; pub mod on_memory; pub mod system_bigram; pub mod system_unigram_lm;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/on_memory/mod.rs
libakaza/src/lm/on_memory/mod.rs
pub mod on_memory_system_bigram_lm; pub mod on_memory_system_unigram_lm;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/on_memory/on_memory_system_bigram_lm.rs
libakaza/src/lm/on_memory/on_memory_system_bigram_lm.rs
use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use crate::cost::calc_cost; use crate::lm::base::SystemBigramLM; pub struct OnMemorySystemBigramLM { // (word_id, word_id) -> cost map: Rc<RefCell<HashMap<(i32, i32), u32>>>, default_edge_cost: f32, pub total_words: u32, pub u...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/lm/on_memory/on_memory_system_unigram_lm.rs
libakaza/src/lm/on_memory/on_memory_system_unigram_lm.rs
use crate::cost::calc_cost; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use crate::lm::base::SystemUnigramLM; pub struct OnMemorySystemUnigramLM { // word -> (word_id, cost) map: Rc<RefCell<HashMap<String, (i32, u32)>>>, pub total_words: u32, pub unique_words: u32, } impl ...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/engine/base.rs
libakaza/src/engine/base.rs
use std::ops::Range; use crate::graph::candidate::Candidate; pub trait HenkanEngine { fn learn(&mut self, candidates: &[Candidate]); fn convert( &self, yomi: &str, force_ranges: Option<&[Range<usize>]>, ) -> anyhow::Result<Vec<Vec<Candidate>>>; }
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/engine/mod.rs
libakaza/src/engine/mod.rs
pub mod base; pub mod bigram_word_viterbi_engine;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/libakaza/src/engine/bigram_word_viterbi_engine.rs
libakaza/src/engine/bigram_word_viterbi_engine.rs
use std::fmt::{Debug, Formatter}; use std::ops::Range; use std::rc::Rc; use std::sync::{Arc, Mutex}; use anyhow::Result; use crate::config::{DictConfig, DictEncoding, DictType, DictUsage, EngineConfig}; use crate::dict::loader::{load_dicts, load_dicts_with_cache}; use crate::engine::base::HenkanEngine; use crate::gra...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/akaza-dict/src/lib.rs
akaza-dict/src/lib.rs
pub mod conf;
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/akaza-dict/src/conf.rs
akaza-dict/src/conf.rs
use std::collections::HashMap; use std::fs; use std::path::Path; use std::sync::{Arc, Mutex}; use anyhow::Result; use encoding_rs::UTF_8; use gtk::glib::signal::Inhibit; use gtk::prelude::*; use gtk::{Application, ApplicationWindow, Button, ListStore}; use gtk4 as gtk; use gtk4::builders::MessageDialogBuilder; use gtk...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
akaza-im/akaza
https://github.com/akaza-im/akaza/blob/b7dace72e7ce2054a9daf6ba0e6aca008bb8926f/akaza-dict/src/bin/akaza-dict.rs
akaza-dict/src/bin/akaza-dict.rs
use anyhow::Result; use log::LevelFilter; use akaza_dict::conf::open_userdict_window; use std::env; /// ใƒ‡ใƒใƒƒใ‚ฐ็”จ fn main() -> Result<()> { let _ = env_logger::builder() .filter_level(LevelFilter::Info) .try_init(); let args: Vec<String> = env::args().collect(); open_userdict_window(&args[1]...
rust
MIT
b7dace72e7ce2054a9daf6ba0e6aca008bb8926f
2026-01-04T19:35:02.740723Z
false
Stavrospanakakis/is_ready
https://github.com/Stavrospanakakis/is_ready/blob/4ff5d7def790bef08ba48dc946b3790af1433ac8/src/lib.rs
src/lib.rs
use clap::Parser; use std::net::TcpStream; use std::process::Command; use std::thread; use std::time::Duration; use tokio::time::timeout; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] struct Args { #[arg(short, long, default_value_t = 30)] timeout: u64, #[arg(short, long =...
rust
MIT
4ff5d7def790bef08ba48dc946b3790af1433ac8
2026-01-04T20:17:06.789960Z
false
Stavrospanakakis/is_ready
https://github.com/Stavrospanakakis/is_ready/blob/4ff5d7def790bef08ba48dc946b3790af1433ac8/src/main.rs
src/main.rs
use std::process; #[tokio::main] async fn main() { if let Err(e) = is_ready::run().await { println!("{}", e); process::exit(1); } }
rust
MIT
4ff5d7def790bef08ba48dc946b3790af1433ac8
2026-01-04T20:17:06.789960Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/build.rs
build.rs
fn main() { built::write_built_file() .expect("Failed to acquire build-time information"); println!("cargo:rerun-if-changed=memory.x"); }
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/stream/src/stream.rs
stream/src/stream.rs
#![allow(non_camel_case_types)] // https://github.com/rust-embedded/heapless/issues/411 use super::{Format, Target}; use core::mem::MaybeUninit; use heapless::{ box_pool, pool::boxed::{Box, BoxBlock}, spsc::{Consumer, Producer, Queue}, }; use smoltcp_nal::embedded_nal::{UdpClientStack, nb}; // Magic first...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/stream/src/lib.rs
stream/src/lib.rs
//! Stabilizer data stream capabilities //! //! # Design //! Data streamining utilizes UDP packets to send data streams at high throughput. //! Packets are always sent in a best-effort fashion, and data may be dropped. //! //! Stabilizer organizes streamed data into batches within a "Frame" that will be sent as a UDP /...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/signal_generator/src/lib.rs
signal_generator/src/lib.rs
#![no_std] use core::iter::Take; use idsp::{AccuOsc, Sweep}; use miniconf::Tree; use rand_core::{RngCore, SeedableRng}; use rand_xorshift::XorShiftRng; use serde::{Deserialize, Serialize}; /// Types of signals that can be generated. #[derive(Copy, Clone, Debug, Deserialize, Serialize)] pub enum Signal { Cosine, ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/design_parameters.rs
src/design_parameters.rs
use arbitrary_int::u5; use fugit::MegahertzU32 as MegaHertz; /// The system clock, used in various timer calculations pub const SYSCLK: MegaHertz = MegaHertz::MHz(400); /// The ADC setup time is the number of seconds after the CSn line goes low before the serial clock /// may begin. This is used for performing the in...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/lib.rs
src/lib.rs
#![no_std] #![cfg_attr(feature = "nightly", feature(core_intrinsics))] pub mod design_parameters; #[cfg(target_os = "none")] pub mod hardware; pub mod telemetry; pub mod convert; pub mod statistics;
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/convert.rs
src/convert.rs
use bitbybit::bitenum; use core::convert::TryFrom; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Default)] #[bitenum(u2, exhaustive = true)] pub enum Gain { #[default] G1 = 0b00, G2 = 0b01, G5 = 0b10, G10 = 0b11, } impl Gain { /// Get the AFE gain as a numerical ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/telemetry.rs
src/telemetry.rs
use crate::convert::{AdcCode, DacCode, Gain}; use serde::Serialize; /// The telemetry buffer is used for storing sample values during execution. /// /// # Note /// These values can be converted to SI units immediately before reporting to save processing time. /// This allows for the DSP process to continually update t...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/statistics.rs
src/statistics.rs
use serde::Serialize; #[derive(Copy, Clone, PartialEq, Eq, Debug, Serialize)] pub struct State { x0: i32, count: u32, min: i32, max: i32, m1: i64, // Note: The variance computation is (almost) the most naive one. // Alternative algorithms (e.g. Welford) are less limited in dynamic // ra...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/setup.rs
src/hardware/setup.rs
//! Stabilizer hardware configuration //! //! This file contains all of the hardware-specific configuration of Stabilizer. use super::hal::{ self, ethernet::{self, PHY}, gpio::{self, Speed}, prelude::*, }; use core::cell::RefCell; use core::sync::atomic::{self, AtomicBool, Ordering}; use core::{fmt::Wri...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
true
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/eeprom.rs
src/hardware/eeprom.rs
use embedded_hal_02::blocking::{delay::DelayUs, i2c::WriteRead}; // The EEPROM is a variant without address bits, so the 3 LSB of this word are "dont-cares". const I2C_ADDR: u8 = 0x50; // The MAC address is stored in the last 6 bytes of the 256 byte address space. const MAC_POINTER: u8 = 0xFA; pub fn read_eui48<T>(i...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/dac.rs
src/hardware/dac.rs
//! Stabilizer DAC management interface //! //! # Design //! //! Stabilizer DACs are connected to the MCU via a simplex, SPI-compatible interface. Each DAC //! accepts a 16-bit output code. //! //! In order to maximize CPU processing time, the DAC code updates are offloaded to hardware using //! a timer compare channel...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/input_stamper.rs
src/hardware/input_stamper.rs
//! Digital Input 0 (DI0) reference clock timestamper //! //! This module provides a means of timestamping the rising edges of an external reference clock on //! the DI0 with a timer value from TIM5. //! //! # Design //! An input capture channel is configured on DI0 and fed into TIM5's capture channel 4. TIM5 is //! th...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/shared_adc.rs
src/hardware/shared_adc.rs
use super::hal; /// Shared Internal ADC Support /// /// # Description /// This module provides an abstraction to share ownership of a single ADC peripheral with multiple /// ADC channels attached to it. /// /// The design of this module mimics that of [`shared-bus`]. /// /// First, the shared ADC is created with the us...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/mod.rs
src/hardware/mod.rs
//! Module for all hardware-specific setup of Stabilizer pub use embedded_hal_02; use embedded_hal_compat::{Forward, markers::ForwardOutputPin}; use hal::{ flash::{LockedFlashBank, UnlockedFlashBank}, gpio::{self, ErasedPin, Input, Output}, }; pub use stm32h7xx_hal as hal; use platform::{ApplicationMetadata, ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/afe.rs
src/hardware/afe.rs
use crate::convert::Gain; /// A programmable gain amplifier that allows for setting the gain via GPIO. pub struct ProgrammableGainAmplifier<P> { a: [P; 2], } impl<P> ProgrammableGainAmplifier<P> where P: embedded_hal_1::digital::OutputPin, { /// Construct a new programmable gain driver. /// /// Ar...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/cpu_temp_sensor.rs
src/hardware/cpu_temp_sensor.rs
//! STM32 Temperature Sensor Driver //! //! # Description //! This file provides an API for measuring the internal STM32 temperature sensor. This temperature //! sensor measures the silicon junction temperature (Tj) and is connected via an internal ADC. use super::hal::{ self, signature::{TS_CAL_30, TS_CAL_110}...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/timers.rs
src/hardware/timers.rs
//! The sampling timer is used for managing ADC sampling and external reference timestamping. use super::hal; use num_enum::TryFromPrimitive; use hal::stm32::{ // TIM1 and TIM8 have identical registers. tim1 as __tim8, tim2 as __tim2, // TIM2 and TIM5 have identical registers. tim2 as __tim5, t...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/net.rs
src/hardware/net.rs
//! Stabilizer network management module //! //! # Design //! The stabilizer network architecture supports numerous layers to permit transmission of //! telemetry (via MQTT), configuration of run-time settings (via MQTT + Miniconf), and data //! streaming over raw UDP/TCP sockets. This module encompasses the main proce...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/adc.rs
src/hardware/adc.rs
//! Stabilizer ADC management interface //! //! # Design //! //! Stabilizer ADCs are connected to the MCU via a simplex, SPI-compatible interface. The ADCs //! require a setup conversion time after asserting the CSn (convert) signal to generate the ADC //! code from the sampled level. Once the setup time has elapsed, t...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/pounder/dds_output.rs
src/hardware/pounder/dds_output.rs
//! The DdsOutput is used as an output stream to the pounder DDS. //! //! # Design //! //! The DDS stream interface is a means of quickly updating pounder DDS (direct digital synthesis) //! outputs of the AD9959 DDS chip. The DDS communicates via a quad-SPI interface and a single //! IO-update output pin. //! //! In or...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/pounder/timestamp.rs
src/hardware/pounder/timestamp.rs
//! ADC sample timestamper using external Pounder reference clock. //! //! # Design //! //! The pounder timestamper utilizes the pounder SYNC_CLK output as a fast external reference clock //! for recording a timestamp for each of the ADC samples. //! //! To accomplish this, a timer peripheral is configured to be driven...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/pounder/hrtimer.rs
src/hardware/pounder/hrtimer.rs
//! The HRTimer (High Resolution Timer) is used to generate IO_Update pulses to the Pounder DDS. use super::hal::{ self, rcc::{ResetEnable, rec}, }; /// A HRTimer output channel. #[allow(dead_code)] pub enum Channel { One, Two, } /// The high resolution timer. Currently, only Timer E is supported. pub...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/hardware/pounder/mod.rs
src/hardware/pounder/mod.rs
use super::hal; use crate::hardware::{I2c1Proxy, shared_adc::AdcChannel}; use ad9959::Address; use embedded_hal_02::blocking::spi::Transfer; use serde::{Deserialize, Serialize}; use strum::IntoEnumIterator; pub mod dds_output; pub mod hrtimer; #[cfg(not(feature = "pounder_v1_0"))] pub mod timestamp; #[derive(Debug, ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/bin/dds.rs
src/bin/dds.rs
//! Urukul as a downstream EEM on stabilizer. //! //! This requires the alternate direction EEM transceiver configuration. //! It exposes the Urukul CPLD and DDS settings via miniconf (MQTT and USB). //! //! Note that several values are not range checked and out-of-range values //! will lead to panics. #![cfg_attr(targ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/bin/fls.rs
src/bin/fls.rs
#![cfg_attr(target_os = "none", no_std)] #![cfg_attr(target_os = "none", no_main)] //! Patent pending: DE102021112017A1 //! //! # Algorithm description //! //! This application can be understood as a universal phase (frequency) //! signal processor. It determines the phase (we will drop frequency //! from now on as in...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
true
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/bin/dual-iir.rs
src/bin/dual-iir.rs
//! # Dual IIR //! //! The Dual IIR application exposes two configurable channels. Stabilizer samples input at a fixed //! rate, digitally filters the data, and then generates filtered output signals on the respective //! channel outputs. //! //! ## Features //! * Two indpenendent channels //! * up to 800 kHz rate, tim...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/src/bin/lockin.rs
src/bin/lockin.rs
//! # Lockin //! //! The `lockin` application implements a lock-in amplifier using either an external or internally //! generated reference. //! //! ## Features //! * Up to 800 kHz sampling //! * Up to 400 kHz modulation frequency //! * Supports internal and external reference sources: //! 1. Internal: Generate ref...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/urukul/src/lib.rs
urukul/src/lib.rs
#![no_std] use arbitrary_int::{u2, u3, u4, u7, u24}; use bitbybit::{bitenum, bitfield}; use embedded_hal::digital::OutputPin; use embedded_hal::spi::{self, SpiBus, SpiDevice}; use embedded_hal_bus::spi::{DeviceError, NoDelay, RefCellDevice}; use num_traits::float::FloatCore; use serde::{Deserialize, Serialize}; use a...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/ad9959/src/lib.rs
ad9959/src/lib.rs
#![no_std] use arbitrary_int::{Number, u2, u3, u4, u5, u10, u14, u24}; use bitbybit::{bitenum, bitfield}; use embedded_hal::{blocking::delay::DelayUs, digital::v2::OutputPin}; /// A trait that allows a HAL to provide a means of communicating with the AD9959. pub trait Interface { type Error; fn configure_mode...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/ad9912/src/lib.rs
ad9912/src/lib.rs
#![no_std] use arbitrary_int::{Number, u5, u10, u14, u48}; use bitbybit::{bitenum, bitfield}; use embedded_hal::spi::{self, Operation, SpiDevice}; use num_traits::float::FloatCore; #[bitenum(u13)] #[derive(PartialEq, Debug)] pub enum Addr { Serial = 0x0000, PartId = 0x0003, Buffer = 0x0004, Update = 0...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/encoded_pin/src/lib.rs
encoded_pin/src/lib.rs
#![no_std] use arbitrary_int::UInt; use core::cell::RefCell; use embedded_hal::digital::{ErrorType, OutputPin}; pub struct EncodedPin<'a, P, const N: usize> { cs: &'a RefCell<[P; N]>, sel: UInt<u8, N>, } impl<'a, P, const N: usize> EncodedPin<'a, P, N> { pub fn new(cs: &'a RefCell<[P; N]>, sel: UInt<u8, ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/serial_settings/src/lib.rs
serial_settings/src/lib.rs
#![doc = include_str!("../README.md")] #![no_std] use embedded_io::{ErrorType, Read, ReadReady, Write}; use heapless::String; use miniconf::{ NodeIter, Path, SerdeError, TreeDeserializeOwned, TreeSchema, TreeSerialize, ValueError, json_core, postcard, }; mod interface; pub use interface::BestEffortInterface; ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/serial_settings/src/interface.rs
serial_settings/src/interface.rs
/// Wrapper type for a "best effort" serial interface. /// /// # Note /// Overflows of the output are silently ignored. pub struct BestEffortInterface<T>(T); impl<T> BestEffortInterface<T> where T: embedded_io::Write + embedded_io::WriteReady + embedded_io::Read + embedded_io::ReadReady, { ...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/mqtt_app.rs
platform/src/mqtt_app.rs
use core::fmt::Write; use heapless::String; use miniconf::Tree; use smoltcp_nal::smoltcp::wire::EthernetAddress; /// Settings that are used for configuring the network interface to Stabilizer. #[derive(Clone, Debug, Tree)] #[tree(meta(doc, typename))] pub struct NetSettings { /// The broker domain name (or IP addr...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/settings.rs
platform/src/settings.rs
//! Stabilizer Settings Management //! //! # Design //! Stabilizer supports two types of settings: //! 1. Static Device Configuration //! 2. Dynamic Run-time Settings //! //! Static device configuration settings are loaded and used only at device power-up. These include //! things like the MQTT broker address and the M...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/flash.rs
platform/src/flash.rs
use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; pub struct AsyncFlash<T>(pub T); pub trait UnlockFlash: ReadNorFlash { type Unlocked<'a>: NorFlash<Error = Self::Error> where Self: 'a; fn unlock(&mut self) -> Self::Unlocked<'_>; } impl<T: ReadNorFlash> ErrorType for AsyncFlas...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/lib.rs
platform/src/lib.rs
#![no_std] #[cfg(target_arch = "arm")] mod dfu; #[cfg(target_arch = "arm")] pub use dfu::*; #[cfg(target_arch = "arm")] mod flash; #[cfg(target_arch = "arm")] pub use flash::*; #[cfg(target_arch = "arm")] mod settings; #[cfg(target_arch = "arm")] pub use settings::*; mod metadata; pub use metadata::*; mod mqtt_app...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/telemetry.rs
platform/src/telemetry.rs
//! Stabilizer Telemetry Capabilities //! //! # Design //! Telemetry is reported regularly using an MQTT client. All telemetry is reported in SI units //! using standard JSON format. //! //! In order to report ADC/DAC codes generated during the DSP routines, a telemetry buffer is //! employed to track the latest codes....
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/delay.rs
platform/src/delay.rs
//! Basic blocking delay //! //! This module provides a basic asm-based blocking delay. use embedded_hal_02::blocking::delay::DelayUs; /// A basic delay implementation. pub struct AsmDelay { frequency_us: u32, } impl AsmDelay { /// Create a new delay. /// /// # Args /// * `freq` - The CPU core fre...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/dfu.rs
platform/src/dfu.rs
use core::{ ptr, sync::atomic::{self, Ordering}, }; /// Flag used to indicate that a reboot to DFU is requested. const DFU_FLAG: u32 = 0xDEAD_BEEF; unsafe extern "C" { unsafe static mut _dfu_flag: u8; } /// Indicate a reboot to DFU is requested. pub fn dfu_reboot() { unsafe { ptr::write_unali...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
quartiq/stabilizer
https://github.com/quartiq/stabilizer/blob/cb1f14508dffa91c636cb3ed3701e24b04e469d2/platform/src/metadata.rs
platform/src/metadata.rs
use core::fmt; use serde::Serialize; #[derive(Serialize)] pub struct ApplicationMetadata { pub firmware_version: &'static str, pub rust_version: &'static str, pub profile: &'static str, pub git_dirty: bool, pub features: &'static str, pub panic_info: &'static str, pub hardware_version: &'st...
rust
Apache-2.0
cb1f14508dffa91c636cb3ed3701e24b04e469d2
2026-01-04T20:16:49.858302Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/lib.rs
src/lib.rs
pub mod cli; pub mod client; pub mod error; pub mod global_conn; pub(crate) mod networking; pub mod server; pub mod shutdown; pub mod telemetry; #[macro_export] macro_rules! leak { ($val:expr, $ty:ty) => { std::boxed::Box::leak(std::boxed::Box::from($val)) as &'static $ty }; ($val:expr) => { ...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/shutdown.rs
src/shutdown.rs
use std::sync::atomic::{AtomicBool, Ordering}; use tokio::sync::Notify; use crate::leak; const WAIT_STOP_PRINT: std::time::Duration = std::time::Duration::from_secs(5); pub struct ShutdownSignal { is_shutdown: AtomicBool, notify: Notify, } impl Default for ShutdownSignal { fn default() -> Self { ...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/cli.rs
src/cli.rs
use std::{ ffi::OsString, path::{Path, PathBuf}, }; use clap::{Parser, Subcommand}; use crate::client::{load_balancing, worker::WorkerType}; fn is_plumber(dir: &Path) -> bool { let plumber = dir.join("plumber.R"); let plumber_entrypoint = dir.join("entrypoint.R"); plumber.exists() || plumber_entr...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/error.rs
src/error.rs
use std::convert::Infallible; use crate::client::ExclusiveBody; pub enum BadRequestReason { MissingHeader(&'static str), InvalidHeader(&'static str), MissingQueryParam(&'static str), InvalidQueryParam(&'static str), NoPathOrQuery, NoHostName, UnsupportedUrlScheme, } pub type FaucetResult<...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/networking.rs
src/networking.rs
use std::{net::SocketAddr, ops::RangeInclusive}; use rand::Rng; use tokio::{io, net::TcpListener}; use crate::error::{FaucetError, FaucetResult}; const UNSAFE_PORTS: &[u16] = &[ 1, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 25, 37, 42, 43, 53, 77, 79, 87, 95, 101, 102, 103, 104, 109, 110, 111, 113, 115, 117,...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/main.rs
src/main.rs
use clap::Parser; use faucet_server::cli::{Args, Commands}; use faucet_server::client::worker::log_stdio; use faucet_server::error::FaucetResult; use faucet_server::leak; use faucet_server::server::logger::build_logger; use faucet_server::server::{FaucetServerBuilder, RouterConfig}; use faucet_server::telemetry::Teleme...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/global_conn.rs
src/global_conn.rs
use std::sync::{atomic::AtomicI64, OnceLock}; pub static CORRENT_CONNECTIONS: OnceLock<AtomicI64> = OnceLock::new(); pub fn add_connection() { CORRENT_CONNECTIONS .get_or_init(|| AtomicI64::new(0)) .fetch_add(1, std::sync::atomic::Ordering::SeqCst); } pub fn remove_connection() { CORRENT_CONN...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/server/onion.rs
src/server/onion.rs
use std::net::IpAddr; pub trait Service<Request>: Send + Sync { type Response; type Error; fn call( &self, req: Request, ip_addr: Option<IpAddr>, ) -> impl std::future::Future<Output = Result<Self::Response, Self::Error>>; } pub trait Layer<S> { type Service; fn layer(&...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/server/service.rs
src/server/service.rs
use std::net::IpAddr; use crate::{ client::{load_balancing::Strategy, Client, ExclusiveBody, UpgradeStatus}, error::FaucetError, server::load_balancing::LoadBalancer, shutdown::ShutdownSignal, }; use hyper::{body::Incoming, header::HeaderValue}; use tokio_tungstenite::tungstenite::protocol::WebSocketCo...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/server/mod.rs
src/server/mod.rs
pub mod logging; pub use logging::{logger, HttpLogData, LogOption}; use tokio_tungstenite::tungstenite::protocol::WebSocketConfig; pub mod onion; mod router; mod service; use crate::{ client::{ load_balancing::{self, LoadBalancer, Strategy}, worker::{WorkerConfigs, WorkerType}, ExclusiveBody...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/server/logging.rs
src/server/logging.rs
use hyper::{http::HeaderValue, Method, Request, Response, Uri, Version}; use serde::de::DeserializeOwned; use uuid::Uuid; use super::onion::{Layer, Service}; use crate::{server::service::State, telemetry::send_http_event}; use std::{net::IpAddr, time}; pub mod logger { use std::{io::BufWriter, io::Write, path::Pa...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/server/router/mod.rs
src/server/router/mod.rs
use std::{ collections::HashSet, ffi::OsStr, net::SocketAddr, num::NonZeroUsize, path::PathBuf, pin::pin, sync::Arc, }; use hyper::{body::Incoming, server::conn::http1, service::service_fn, Request, Uri}; use hyper_util::rt::TokioIo; use tokio::net::TcpListener; use tokio_tungstenite::tungstenite::{http::uri::...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/websockets.rs
src/client/websockets.rs
use super::{pool::ExtractSocketAddr, Client, ExclusiveBody}; use crate::{ error::{BadRequestReason, FaucetError, FaucetResult}, global_conn::{add_connection, remove_connection}, server::logging::{EventLogData, FaucetTracingLevel}, shutdown::ShutdownSignal, telemetry::send_log_event, }; use base64::E...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/worker.rs
src/client/worker.rs
use crate::{ error::{FaucetError, FaucetResult}, leak, networking::get_available_socket, server::{ logging::{parse_faucet_event, FaucetEventResult}, FaucetServerConfig, }, shutdown::ShutdownSignal, telemetry::send_log_event, }; use std::{ ffi::OsStr, net::SocketAddr, ...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/mod.rs
src/client/mod.rs
mod body; mod pool; mod websockets; pub mod load_balancing; pub mod worker; pub use body::ExclusiveBody; pub(crate) use pool::Client; pub use pool::ExtractSocketAddr; pub use websockets::UpgradeStatus;
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/body.rs
src/client/body.rs
use std::pin::Pin; use super::pool::HttpConnection; use crate::error::FaucetError; use http_body_util::{BodyExt, Empty, Full}; use hyper::body::{Body, Bytes, SizeHint}; pub struct ExclusiveBody { inner: Pin<Box<dyn Body<Data = Bytes, Error = FaucetError> + Send + 'static>>, _connection: Option<HttpConnection>...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/pool.rs
src/client/pool.rs
use super::body::ExclusiveBody; use super::worker::WorkerConfig; use crate::error::{FaucetError, FaucetResult}; use crate::global_conn::{add_connection, remove_connection}; use deadpool::managed::{self, Object, Pool, RecycleError}; use http_body_util::BodyExt; use hyper::body::Incoming; use hyper::client::conn::http1::...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/load_balancing/rps_autoscale.rs
src/client/load_balancing/rps_autoscale.rs
use rand::Rng; use tokio::sync::Mutex; use super::LoadBalancingStrategy; use crate::client::{worker::WorkerConfig, Client}; use std::net::IpAddr; struct RequestCounter { last_reset: std::time::Instant, current_window: f64, previous_window_rps: f64, big_reset_counter: f64, pub max_rps: f64, } cons...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/load_balancing/cookie_hash.rs
src/client/load_balancing/cookie_hash.rs
use uuid::Uuid; use super::LoadBalancingStrategy; use super::WorkerConfig; use crate::client::Client; use crate::leak; use std::time::Duration; struct Targets { targets: &'static [Client], } impl Targets { fn new(configs: &[&'static WorkerConfig]) -> Self { let mut targets = Vec::new(); for s...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/load_balancing/ip_hash.rs
src/client/load_balancing/ip_hash.rs
use super::LoadBalancingStrategy; use super::WorkerConfig; use crate::client::Client; use crate::leak; use std::net::IpAddr; use std::time::Duration; struct Targets { targets: &'static [Client], } impl Targets { fn new(configs: &[&'static WorkerConfig]) -> Self { let mut targets = Vec::new(); ...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/load_balancing/ip_extractor.rs
src/client/load_balancing/ip_extractor.rs
use crate::error::{BadRequestReason, FaucetError, FaucetResult}; use hyper::{http::HeaderValue, Request}; use std::net::IpAddr; #[derive(Clone, Copy, Debug, serde::Deserialize)] #[serde(rename = "snake_case")] pub enum IpExtractor { ClientAddr, XForwardedFor, XRealIp, } const MISSING_X_FORWARDED_FOR: Fauc...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/load_balancing/mod.rs
src/client/load_balancing/mod.rs
pub mod cookie_hash; mod ip_extractor; pub mod ip_hash; pub mod round_robin; pub mod rps_autoscale; use super::worker::WorkerConfig; use crate::client::Client; use crate::error::FaucetResult; use crate::leak; use cookie_hash::CookieHash; use hyper::Request; pub use ip_extractor::IpExtractor; use std::net::IpAddr; use ...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/client/load_balancing/round_robin.rs
src/client/load_balancing/round_robin.rs
use super::LoadBalancingStrategy; use crate::client::{worker::WorkerConfig, Client}; use std::{net::IpAddr, sync::atomic::AtomicUsize}; struct Targets { targets: &'static [Client], index: AtomicUsize, } // 500us is the time it takes for the round robin to move to the next target // in the unlikely event that ...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/telemetry/mod.rs
src/telemetry/mod.rs
use std::{path::Path, str::FromStr, sync::OnceLock}; mod pg; use chrono::Local; use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod}; use tokio::{sync::mpsc::UnboundedSender, task::JoinHandle}; use crate::{ cli::PgSslMode, error::FaucetResult, leak, server::{logging::EventLogData, H...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false
ixpantia/faucet
https://github.com/ixpantia/faucet/blob/e11015f009992d1f6399cd5a18bddeaab2b443ec/src/telemetry/pg.rs
src/telemetry/pg.rs
use chrono::{DateTime, Local}; use deadpool_postgres::Pool; use std::path::Path; use std::{io::Write, pin::pin}; use tokio::{sync::mpsc::UnboundedReceiver, task::JoinHandle}; use crate::server::logging::EventLogData; use crate::{ cli::PgSslMode, server::{HttpLogData, LogOption}, shutdown::ShutdownSignal, }...
rust
MIT
e11015f009992d1f6399cd5a18bddeaab2b443ec
2026-01-04T20:17:10.449299Z
false