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
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/src/containers.rs
tpnote-html2md/src/containers.rs
use crate::markup5ever_rcdom; use super::StructuredPrinter; use super::TagHandler; use markup5ever_rcdom::Handle; #[derive(Default)] pub struct ContainerHandler; impl TagHandler for ContainerHandler { fn handle(&mut self, _tag: &Handle, printer: &mut StructuredPrinter) { printer.insert_newline(); ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/src/paragraphs.rs
tpnote-html2md/src/paragraphs.rs
use crate::markup5ever_rcdom; use super::StructuredPrinter; use super::TagHandler; use markup5ever_rcdom::{Handle, NodeData}; #[derive(Default)] pub struct ParagraphHandler { paragraph_type: String, } impl TagHandler for ParagraphHandler { fn handle(&mut self, tag: &Handle, printer: &mut StructuredPrinter) ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/src/images.rs
tpnote-html2md/src/images.rs
use super::StructuredPrinter; use super::TagHandler; use crate::common::get_tag_attr; use crate::dummy::IdentityHandler; use crate::markup5ever_rcdom; use markup5ever_rcdom::Handle; use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS}; const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').a...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/src/bin/html2md.rs
tpnote-html2md/src/bin/html2md.rs
extern crate html2md; use std::io::{self, Read}; fn main() { let stdin = io::stdin(); let mut buffer = String::new(); let mut handle = stdin.lock(); handle .read_to_string(&mut buffer) .expect("Must be readable HTML!"); println!("{}", html2md::parse_html(&buffer)); }
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/unit.rs
tpnote-html2md/tests/unit.rs
extern crate html2md; use html2md::parse_html; #[test] fn test_dumb() { let md = parse_html("<p>CARTHAPHILUS</p>"); assert_eq!(md, "CARTHAPHILUS") } #[test] fn test_anchor() { let md = parse_html(r#"<p><a href="http://ya.ru">APOSIMZ</a></p>"#); assert_eq!(md, "[APOSIMZ](http://ya.ru)") } #[test] fn ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/styles.rs
tpnote-html2md/tests/styles.rs
extern crate html2md; use html2md::parse_html; #[test] fn test_styles_with_spaces() { let md = parse_html(r#"It read:<s> Nobody will ever love you</s>"#); assert_eq!(md, r#"It read: ~~Nobody will ever love you~~"#) } #[test] fn test_styles_with_newlines() { let md = parse_html( r#" And she said:<...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/quotes.rs
tpnote-html2md/tests/quotes.rs
extern crate html2md; use html2md::parse_html; use indoc::indoc; #[test] fn test_quotes() { let md = parse_html( "<p><blockquote>here's a quote\n next line of it</blockquote>And some text after it</p>", ); assert_eq!( md, "\ > here's a quote next line of it And some text after it"...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/iframes.rs
tpnote-html2md/tests/iframes.rs
extern crate html2md; use html2md::parse_html; #[test] fn test_youtube_simple() { let md = parse_html("<iframe src='https://www.youtube.com/embed/zE-dmXZp3nU?wmode=opaque' class='fr-draggable' width='640' height='360'></iframe>"); assert_eq!(md, "[![Embedded YouTube video](https://img.youtube.com/vi/zE-dmXZp3...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/lists.rs
tpnote-html2md/tests/lists.rs
extern crate html2md; use html2md::parse_html; #[test] fn test_list_simple() { let md = parse_html( r#"<p><ul><li>Seven things has lady Lackless</li><li>Keeps them underneath her black dress</li><li>One a thing that's not for wearing</li></ul></p>"#, ); assert_eq!( md, "\ * Seven t...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/integration.rs
tpnote-html2md/tests/integration.rs
extern crate html2md; use html2md::parse_html; use std::fs::File; use std::io::prelude::*; use indoc::indoc; #[test] #[ignore] fn test_marcfs() { let mut html = String::new(); let mut html_file = File::open("tests/input/marcfs-readme.html").unwrap(); html_file .read_to_string(&mut html) ....
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/tables.rs
tpnote-html2md/tests/tables.rs
extern crate html2md; use html2md::parse_html; #[test] fn test_tables() { let md = parse_html( r#"<table> <thead> <tr> <th scope='col'>Minor1</th> <th scope='col'>Minor2</th> <th scope='col'>Minor3</th> <th scope='col'>Minor4</th> </tr> </thead> <tbody> <tr> ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-html2md/tests/images.rs
tpnote-html2md/tests/images.rs
extern crate html2md; use html2md::parse_html; #[test] fn test_image_native_simple() { let md = parse_html("<img src=\"https://i.redd.it/vesfbmwfkz811.png\" alt=\"image of Linus holding his laptop\" title=\"Daddy Linus\" />"); assert_eq!( md, "![image of Linus holding his laptop](https://i.red...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/build.rs
tpnote/build.rs
extern crate winresource; use std::env; use std::error::Error; use winresource::WindowsResource; /// Cross compile with icons is a new feature in `winres 0.1.12`: /// /// * [Adding an icon issues when building from Linux for Windows · Issue #33 · mxre/winres · GitHub](https://github.com/mxre/winres/issues/33) /// * ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/config.rs
tpnote/src/config.rs
//! Sets configuration defaults, reads, and writes Tp-Note's configuration //! file and exposes the configuration as `static` variable. use crate::error::ConfigFileError; use crate::settings::ClapLevelFilter; use crate::settings::ARGS; use crate::settings::DOC_PATH; use crate::settings::ENV_VAR_TPNOTE_CONFIG; use direc...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/alert_service.rs
tpnote/src/alert_service.rs
//! Receives strings by a message channel, queues them and displays them //! one by one in popup alert windows. use std::sync::mpsc::sync_channel; use std::sync::mpsc::Receiver; use std::sync::mpsc::RecvTimeoutError; use std::sync::mpsc::SendError; use std::sync::mpsc::SyncSender; use std::sync::LazyLock; use std::syn...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/settings.rs
tpnote/src/settings.rs
//! Reads the command line parameters and clipboard and exposes them as `static` //! variables. //#[cfg(any(feature = "read-clipboard", feature = "viewer"))] use crate::clipboard::SystemClipboard; use crate::config::CFG; use clap::Parser; use clap::ValueEnum; use serde::Deserialize; use serde::Serialize; use std::env;...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/logger.rs
tpnote/src/logger.rs
//! Prints error messages and exceptional states. use crate::CONFIG_PATHS; #[cfg(feature = "message-box")] use crate::PKG_VERSION; #[cfg(feature = "message-box")] use crate::alert_service::AlertService; use crate::config::CARGO_BIN_NAME; #[cfg(feature = "message-box")] use crate::settings::ARGS; #[cfg(feature = "messa...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/clipboard.rs
tpnote/src/clipboard.rs
//! Abstract the clipboard handling. #[cfg(feature = "read-clipboard")] use clipboard_rs::Clipboard; #[cfg(feature = "read-clipboard")] use clipboard_rs::ClipboardContext; use tpnote_lib::config::TMPL_VAR_HTML_CLIPBOARD; use tpnote_lib::config::TMPL_VAR_TXT_CLIPBOARD; use tpnote_lib::content::Content; use tpnote_lib::...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/file_editor.rs
tpnote/src/file_editor.rs
//! Launch the user's favorite file editor. use crate::config::CFG; use crate::error::ConfigFileError; use crate::process_ext::ChildExt; use crate::settings::ENV_VAR_TPNOTE_EDITOR; use crate::settings::RUNS_ON_CONSOLE; use percent_encoding::percent_decode_str; use std::env; #[cfg(not(target_family = "windows"))] use s...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/template.rs
tpnote/src/template.rs
//! Helper functions dealing with `TemplateKind` variants. use crate::config::CFG; use crate::settings::ARGS; use tpnote_lib::template::TemplateKind; /// Helper function to inhibit template application according to /// command line parameters. pub(crate) fn template_kind_filter(template_kind: TemplateKind) -> Templat...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/process_ext.rs
tpnote/src/process_ext.rs
//! Module extending the process handling. #[cfg(target_family = "windows")] use std::os::windows::io::AsRawHandle; use std::process::Child; use std::process::ExitStatus; #[cfg(target_family = "windows")] use std::thread::sleep; #[cfg(target_family = "windows")] use std::time::Duration; #[cfg(target_family = "windows"...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/workflow.rs
tpnote/src/workflow.rs
//! High level program logic implementing the whole workflow. use crate::config::CFG; use crate::error::WorkflowError; use crate::file_editor::launch_editor; use crate::settings::ARGS; use crate::settings::DOC_PATH; use crate::settings::LAUNCH_EDITOR; use crate::settings::LAUNCH_VIEWER; use crate::settings::STDIN; use ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/error.rs
tpnote/src/error.rs
//! Custom error types. use std::path::PathBuf; use std::process::ExitStatus; use thiserror::Error; use tpnote_lib::error::FileError; use tpnote_lib::error::LibCfgError; use tpnote_lib::error::NoteError; #[allow(dead_code)] #[derive(Debug, Error)] /// Error arising in the `workflow` and `main` module. pub enum Workflo...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/main.rs
tpnote/src/main.rs
#![windows_subsystem = "windows"] #![allow(clippy::vec_init_then_push)] //! _Tp-Note_ is a note taking tool and a template system, that consistently //! synchronizes the note's metadata with its filename. //! _Tp-Note's_ main design goal is to convert some input text - //! usually provided by the system's clipboard - i...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/watcher.rs
tpnote/src/viewer/watcher.rs
//! Implements the file watcher for the note viewer feature. use crate::config::CFG; use crate::viewer::error::ViewerError; use crate::viewer::sse_server::SseToken; use notify::RecursiveMode; use notify_debouncer_mini::Config; use notify_debouncer_mini::{new_debouncer_opt, DebouncedEvent, Debouncer}; use std::panic::p...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/http_response.rs
tpnote/src/viewer/http_response.rs
//! HTTP response renderer and sender for all documents with one exception: //! The content type `text/event-stream` is generated in the module //! `sse_server`. use super::sse_server::ServerThread; use crate::config::CFG; use crate::viewer::error::ViewerError; use std::borrow::Cow; use std::fs; use std::io::{Read, Wr...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/error.rs
tpnote/src/viewer/error.rs
//! The viewer feature's error type. use crate::error::ConfigFileError; use core::str::Utf8Error; use std::sync::mpsc::RecvError; use thiserror::Error; use tpnote_lib::error::{FileError, NoteError}; /// Represents an error in the viewer feature. /// Hint: to see this error restart _Tp-Note_ with `--debug debug`. #[der...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/mod.rs
tpnote/src/viewer/mod.rs
//! Modules implementing the note content renderer and viewer feature. mod error; mod http_response; pub mod init; mod sse_server; mod watcher; mod web_browser; use crate::viewer::init::Viewer; use std::path::Path; use std::thread; use std::thread::JoinHandle; #[inline] /// Launches a file watcher and Markdown render...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/init.rs
tpnote/src/viewer/init.rs
//! Main module for the markup renderer and note viewer feature. use crate::config::CFG; use crate::settings::ARGS; use crate::settings::LAUNCH_EDITOR; use crate::viewer::error::ViewerError; use crate::viewer::sse_server::manage_connections; use crate::viewer::sse_server::SseToken; use crate::viewer::watcher::FileWatc...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/web_browser.rs
tpnote/src/viewer/web_browser.rs
//! Launch the user's favorite web browser. use crate::config::CFG; use crate::error::ConfigFileError; use crate::process_ext::ChildExt; use crate::settings::ENV_VAR_TPNOTE_BROWSER; use crate::viewer::error::ViewerError; use percent_encoding::percent_decode_str; use std::env; use std::process::Command; use std::process...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote/src/viewer/sse_server.rs
tpnote/src/viewer/sse_server.rs
//! Server-sent-event server for the note viewer feature. //! This module contains also the web browser JavaScript client code. use crate::config::CFG; use crate::viewer::error::ViewerError; use crate::viewer::http_response::HttpResponse; use crate::viewer::init::LOCALHOST; use parking_lot::RwLock; use percent_encodin...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/config.rs
tpnote-lib/src/config.rs
//! Set configuration defaults by reading the internal default //! configuration file `LIB_CONFIG_DEFAULT_TOML`. After processing, the //! configuration data is exposed via the variable `LIB_CFG` behind a //! mutex. This makes it possible to modify all configuration defaults //! (including templates) at runtime. //! //...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/settings.rs
tpnote-lib/src/settings.rs
//! Configuration data that origins from environment variables. //! Unlike the configuration data in `LIB_CFG` which is sourced only once when //! Tp-Note is launched, the `SETTINGS` object may be sourced more often in //! order to follow changes in the related environment variables. use crate::config::{GetLang, LIB_C...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/html.rs
tpnote-lib/src/html.rs
//! Helper functions dealing with HTML conversion. use crate::clone_ext::CloneExt; use crate::error::InputStreamError; use crate::filename::{NotePath, NotePathStr}; use crate::{config::LocalLinkKind, error::NoteError}; use html_escape; use parking_lot::RwLock; use parse_hyperlinks::parser::Link; use parse_hyperlinks_ex...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/lib.rs
tpnote-lib/src/lib.rs
//! The `tpnote-lib` library is designed to embed Tp-Note's core function in //! common text editors and text editor plugins. It is dealing with templates //! and input files and is also part of the command line application //! [Tp-Note](https://blog.getreu.net/projects/tp-note/). This library also //! provides a defau...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/highlight.rs
tpnote-lib/src/highlight.rs
//! Syntax highlighting for (inline) source code blocks in Markdown input. use pulldown_cmark::{CodeBlockKind, Event, Tag, TagEnd}; use syntect::highlighting::ThemeSet; use syntect::html::css_for_theme_with_class_style; use syntect::html::{ClassStyle, ClassedHTMLGenerator}; use syntect::parsing::SyntaxSet; use syntect...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/filename.rs
tpnote-lib/src/filename.rs
//! Helper functions dealing with filenames. use crate::config::FILENAME_COPY_COUNTER_MAX; use crate::config::FILENAME_DOTFILE_MARKER; use crate::config::FILENAME_EXTENSION_SEPARATOR_DOT; use crate::config::FILENAME_LEN_MAX; use crate::config::LIB_CFG; use crate::error::FileError; use crate::markup_language::MarkupLang...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/front_matter.rs
tpnote-lib/src/front_matter.rs
//! Creates a memory representation of the note's YAML header. //! In this documentation, the terms “YAML header”, ”header” and ”front matter" //! are used as synonyms for the note's meta data block at the beginning //! of the text file. Technically this is a wrapper around a `tera::Map`. use crate::error::NoteError; u...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/markup_language.rs
tpnote-lib/src/markup_language.rs
//! Helper functions dealing with markup languages. use crate::config::LIB_CFG; use crate::error::NoteError; #[cfg(feature = "renderer")] use crate::highlight::SyntaxPreprocessor; #[cfg(feature = "renderer")] use crate::html2md::convert_html_to_md; use crate::settings::SETTINGS; use parse_hyperlinks::renderer::text_lin...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/content.rs
tpnote-lib/src/content.rs
//! Self referencing data structures to store the note's //! content as a raw string. use self_cell::self_cell; use std::fmt; use std::fmt::Debug; use std::fs::File; use std::fs::OpenOptions; use std::fs::create_dir_all; use std::io::Write; use std::path::Path; use substring::Substring; use crate::config::TMPL_VAR_DOC...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/filter.rs
tpnote-lib/src/filter.rs
//! Extends the built-in Tera filters. //! All custom filters check the type of their input variables at runtime and //! throw an error if the type is other than specified. use crate::config::FILENAME_DOTFILE_MARKER; use crate::config::LIB_CFG; use crate::config::Scheme; use crate::config::TMPL_VAR_FM_; use crate::file...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/html_renderer.rs
tpnote-lib/src/html_renderer.rs
//! Tp-Note's high level HTML rendering API. //! //! A set of functions that take a `Context` type and a `Content` type (or raw //! text) and return the HTML rendition of the content. The API is completely //! stateless. All functions read the `LIB_CFG` global variable to read the //! configuration stored in `LibCfg.tm...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/template.rs
tpnote-lib/src/template.rs
//!Abstractions for content templates and filename templates. use crate::filename::NotePath; use crate::settings::SETTINGS; use crate::{config::LIB_CFG, content::Content}; use std::path::Path; /// Each workflow is related to one `TemplateKind`, which relates to one /// content template and one filename template. #[non...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/workflow.rs
tpnote-lib/src/workflow.rs
//! Tp-Note's high level API.<!-- The low level API is documented //! in the module `tpnote_lib::note`. --> //! //! How to integrate this in your text editor code? //! First, call `create_new_note_or_synchronize_filename()` //! with the first positional command line parameter `<path>`. //! Then open the new text file w...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/error.rs
tpnote-lib/src/error.rs
//! Custom error types. use std::io; use std::path::PathBuf; use thiserror::Error; /// The error `InvalidFrontMatterYaml` prints the front matter section of the /// note file. This constant limits the number of text lines that are printed. pub const FRONT_MATTER_ERROR_MAX_LINES: usize = 20; /// Error related to the ...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/clone_ext.rs
tpnote-lib/src/clone_ext.rs
//! Extension trait adding a `shallow_clone()` method to `Cow`. use std::borrow::Cow; pub trait CloneExt<'b> { /// Clone a `Cow` without memory allocation. /// Note, the original must outlive the clone! Use case: /// ```no_run /// use crate::tpnote_lib::clone_ext::CloneExt; /// use std::borrow::Cow...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/text_reader.rs
tpnote-lib/src/text_reader.rs
//! An iterator adapter to suppress CRLF (`\r\n`) sequences in a stream of //! bytes. //! //! # Overview //! //! This module provides [`CrlfSuppressor`], an iterator adapter to filter out //! CR (`\r`, 0x0D) when it is immediately followed by LF (`\n`, 0x0A), as //! commonly found in Windows line endings. //! //! It al...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/config_value.rs
tpnote-lib/src/config_value.rs
//! Provides a newtype for `toml::map::Map<String, Value>)` with methods //! to merge (incomplete) configuration data from different sources (files). use std::str::FromStr; use serde::{Deserialize, Serialize}; use toml::Value; use crate::error::LibCfgError; /// This decides until what depth arrays are merged into t...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/lingua.rs
tpnote-lib/src/lingua.rs
//! This module abstracts the Lingua library API. use crate::settings::SETTINGS; use crate::{config::Mode, error::LibCfgError}; pub(crate) use lingua::IsoCode639_1; use lingua::{LanguageDetector, LanguageDetectorBuilder}; use parse_hyperlinks::iterator::MarkupLink; use parse_hyperlinks::parser::Link; use std::collectio...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/note.rs
tpnote-lib/src/note.rs
//! Tp-Note's low level API, creating a memory representation of a //! note file by inserting Tp-Note's //! environment data in some templates. If the note exists on disk already, //! the memory representation is established be reading the note file and //! parsing its front matter. //! NB: The high level API is in the...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/html2md.rs
tpnote-lib/src/html2md.rs
//! This module abstracts the HTML to Markdown filter. use crate::error::NoteError; use html2md::parse_html; /* // Alternative implementation: /// Abstracts the HTML to Markdown conversion. /// This implementation uses the `htmd` crate. #[inline] pub(crate) fn convert_html_to_md(html: &str) -> Result<String, NoteError...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
false
getreu/tp-note
https://github.com/getreu/tp-note/blob/4a373fcf860c8d7a8c3da02f4ab23441f91738ae/tpnote-lib/src/context.rs
tpnote-lib/src/context.rs
//! Extends the built-in Tera filters. use tera::Value; use crate::config::Assertion; use crate::config::FILENAME_ROOT_PATH_MARKER; use crate::config::LIB_CFG; #[cfg(feature = "viewer")] use crate::config::TMPL_HTML_VAR_DOC_ERROR; #[cfg(feature = "viewer")] use crate::config::TMPL_HTML_VAR_DOC_TEXT; use crate::config:...
rust
Apache-2.0
4a373fcf860c8d7a8c3da02f4ab23441f91738ae
2026-01-04T20:18:01.333543Z
true
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/src/stream.rs
src/stream.rs
use core::char; use core::cmp; use core::ops::Range; use core::str; use crate::{StrSpan, StreamError, TextPos, XmlByteExt, XmlCharExt}; type Result<T> = ::core::result::Result<T, StreamError>; /// Representation of the [Reference](https://www.w3.org/TR/xml/#NT-Reference) value. #[derive(Clone, Copy, PartialEq, Eq, H...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/src/lib.rs
src/lib.rs
//! [<img alt="github" src="https://img.shields.io/badge/github-RazrFalcon/xmlparser-8da0cb?style=for-the-badge&logo=github" height="20">](https://github.com/RazrFalcon/xmlparser) //! [<img alt="crates.io" src="https://img.shields.io/crates/v/xmlparser.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
true
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/src/error.rs
src/error.rs
use core::fmt; use core::str; #[cfg(feature = "std")] use std::error; /// An XML parser errors. #[allow(missing_docs)] #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum Error { InvalidDeclaration(StreamError, TextPos), InvalidComment(StreamError, TextPos), InvalidPI(StreamError, TextPos), Inv...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/src/xmlchar.rs
src/xmlchar.rs
/// Extension methods for XML-subset only operations. pub trait XmlCharExt { /// Checks if the value is within the /// [NameStartChar](https://www.w3.org/TR/xml/#NT-NameStartChar) range. fn is_xml_name_start(&self) -> bool; /// Checks if the value is within the /// [NameChar](https://www.w3.org/TR/...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/src/strspan.rs
src/strspan.rs
use core::fmt; use core::ops::{Deref, Range}; /// A string slice. /// /// Like `&str`, but also contains the position in the input XML /// from which it was parsed. #[must_use] #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct StrSpan<'a> { text: &'a str, start: usize, } impl<'a> From<&'a str> for StrSpa...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/comments.rs
tests/integration/comments.rs
use crate::token::*; test!( comment_01, "<!--comment-->", Token::Comment("comment", 0..14) ); test!(comment_02, "<!--<head>-->", Token::Comment("<head>", 0..13)); test!(comment_03, "<!--<!-x-->", Token::Comment("<!-x", 0..11)); test!(comment_04, "<!--<!x-->", Token::Comment("<!x", 0..10)); test!(comment_05...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/document.rs
tests/integration/document.rs
use std::str; use crate::token::*; test!(document_01, "",); test!(document_02, " ",); test!(document_03, " \n\t\r ",); // BOM test!( document_05, str::from_utf8(b"\xEF\xBB\xBF<a/>").unwrap(), Token::ElementStart("", "a", 3..5), Token::ElementEnd(ElementEnd::Empty, 5..7) ); test!( document_0...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/text.rs
tests/integration/text.rs
use crate::token::*; test!( text_01, "<p>text</p>", Token::ElementStart("", "p", 0..2), Token::ElementEnd(ElementEnd::Open, 2..3), Token::Text("text", 3..7), Token::ElementEnd(ElementEnd::Close("", "p"), 7..11) ); test!( text_02, "<p> text </p>", Token::ElementStart("", "p", 0..2),...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/api.rs
tests/integration/api.rs
extern crate xmlparser; use xmlparser::*; #[test] fn text_pos_1() { let mut s = Stream::from("text"); s.advance(2); assert_eq!(s.gen_text_pos(), TextPos::new(1, 3)); } #[test] fn text_pos_2() { let mut s = Stream::from("text\ntext"); s.advance(6); assert_eq!(s.gen_text_pos(), TextPos::new(2, ...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/doctype.rs
tests/integration/doctype.rs
use crate::token::*; test!( dtd_01, "<!DOCTYPE greeting SYSTEM \"hello.dtd\">", Token::EmptyDtd("greeting", Some(ExternalId::System("hello.dtd")), 0..38) ); test!( dtd_02, "<!DOCTYPE greeting PUBLIC \"hello.dtd\" \"goodbye.dtd\">", Token::EmptyDtd( "greeting", Some(ExternalId::...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/elements.rs
tests/integration/elements.rs
use crate::token::*; test!( element_01, "<a/>", Token::ElementStart("", "a", 0..2), Token::ElementEnd(ElementEnd::Empty, 2..4) ); test!( element_02, "<a></a>", Token::ElementStart("", "a", 0..2), Token::ElementEnd(ElementEnd::Open, 2..3), Token::ElementEnd(ElementEnd::Close("", "a"...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/pi.rs
tests/integration/pi.rs
use crate::token::*; test!(pi_01, "<?xslt ma?>", Token::PI("xslt", Some("ma"), 0..11)); test!( pi_02, "<?xslt \t\n m?>", Token::PI("xslt", Some("m"), 0..13) ); test!(pi_03, "<?xslt?>", Token::PI("xslt", None, 0..8)); test!(pi_04, "<?xslt ?>", Token::PI("xslt", None, 0..9)); test!( pi_05, "<?xml...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/main.rs
tests/integration/main.rs
extern crate xmlparser as xml; #[macro_use] mod token; mod api; mod cdata; mod comments; mod doctype; mod document; mod elements; mod pi; mod text;
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/cdata.rs
tests/integration/cdata.rs
extern crate xmlparser as xml; use crate::token::*; test!( cdata_01, "<p><![CDATA[content]]></p>", Token::ElementStart("", "p", 0..2), Token::ElementEnd(ElementEnd::Open, 2..3), Token::Cdata("content", 3..22), Token::ElementEnd(ElementEnd::Close("", "p"), 22..26) ); test!( cdata_02, "...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/tests/integration/token.rs
tests/integration/token.rs
type Range = ::std::ops::Range<usize>; #[derive(PartialEq, Debug)] pub enum Token<'a> { Declaration(&'a str, Option<&'a str>, Option<bool>, Range), PI(&'a str, Option<&'a str>, Range), Comment(&'a str, Range), DtdStart(&'a str, Option<ExternalId<'a>>, Range), EmptyDtd(&'a str, Option<ExternalId<'a>...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/fuzz/fuzz_targets/fuzz_xml.rs
fuzz/fuzz_targets/fuzz_xml.rs
#![no_main] #[macro_use] extern crate libfuzzer_sys; extern crate xmlparser; use std::str; fuzz_target!(|data: &[u8]| { if let Ok(text) = str::from_utf8(data) { let mut n = 0; for _ in xmlparser::Tokenizer::from(text) { n += 1; if n == 1000 { panic!("endle...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/examples/parse.rs
examples/parse.rs
extern crate xmlparser as xml; use std::env; use std::fs; use std::io::Read; fn main() { let args = env::args().collect::<Vec<String>>(); if args.len() != 2 { println!("Usage: parse file.xml"); return; } let text = load_file(&args[1]); if let Err(e) = parse(&text) { print...
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
RazrFalcon/xmlparser
https://github.com/RazrFalcon/xmlparser/blob/9c8e34305723118c67d7feba95772705b2247776/afl-fuzz/src/main.rs
afl-fuzz/src/main.rs
extern crate afl; extern crate xmlparser; use std::str; use afl::fuzz; fn main() { fuzz!(|data: &[u8]| { if let Ok(text) = str::from_utf8(data) { for _ in xmlparser::Tokenizer::from(text) {} } }); }
rust
Apache-2.0
9c8e34305723118c67d7feba95772705b2247776
2026-01-04T20:18:02.902370Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/location_service.rs
crates/discovery/src/location_service.rs
use anyhow::{Context, Result}; use reqwest::Client; use serde::{Deserialize, Serialize}; use shared::models::node::NodeLocation; use std::time::Duration; #[derive(Debug, Deserialize, Serialize)] struct IpApiResponse { ip: String, city: Option<String>, region: Option<String>, country: Option<String>, ...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/lib.rs
crates/discovery/src/lib.rs
mod api; mod chainsync; mod location_enrichment; mod location_service; mod store; pub use api::server::start_server; pub use chainsync::ChainSync; pub use location_enrichment::LocationEnrichmentService; pub use location_service::LocationService; pub use store::node_store::NodeStore; pub use store::redis::RedisStore;
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/location_enrichment.rs
crates/discovery/src/location_enrichment.rs
use crate::location_service::LocationService; use crate::store::node_store::NodeStore; use anyhow::Result; use log::{error, info, warn}; use redis::AsyncCommands; use std::sync::Arc; use std::time::Duration; use tokio::time::interval; const LOCATION_RETRY_KEY: &str = "location:retries:"; const MAX_RETRIES: u32 = 3; co...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/main.rs
crates/discovery/src/main.rs
use alloy::providers::RootProvider; use anyhow::Result; use clap::Parser; use log::LevelFilter; use log::{error, info}; use shared::web3::contracts::core::builder::ContractBuilder; use std::sync::Arc; use std::time::Duration; use tokio::sync::Mutex; use tokio_util::sync::CancellationToken; use discovery::{ start_s...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/store/node_store.rs
crates/discovery/src/store/node_store.rs
use crate::store::redis::RedisStore; use anyhow::Error; use log::error; use redis::AsyncCommands; use shared::models::node::{DiscoveryNode, Node}; pub struct NodeStore { redis_store: RedisStore, } impl NodeStore { pub fn new(redis_store: RedisStore) -> Self { Self { redis_store } } async fn g...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/store/mod.rs
crates/discovery/src/store/mod.rs
pub(crate) mod node_store; pub(crate) mod redis;
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/store/redis.rs
crates/discovery/src/store/redis.rs
#[cfg(test)] use log::debug; use log::info; use redis::Client; #[cfg(test)] use redis_test::server::RedisServer; #[cfg(test)] use std::sync::Arc; #[cfg(test)] use std::thread; #[cfg(test)] use std::time::Duration; #[derive(Clone)] pub struct RedisStore { pub client: Client, #[allow(dead_code)] #[cfg(test)] ...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/api/mod.rs
crates/discovery/src/api/mod.rs
pub(crate) mod routes; pub(crate) mod server;
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/api/server.rs
crates/discovery/src/api/server.rs
use crate::api::routes::get_nodes::{get_node_by_subkey, get_nodes, get_nodes_for_pool}; use crate::api::routes::node::node_routes; use crate::store::node_store::NodeStore; use crate::store::redis::RedisStore; use actix_web::middleware::{Compress, NormalizePath, TrailingSlash}; use actix_web::HttpResponse; use actix_web...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/api/routes/node.rs
crates/discovery/src/api/routes/node.rs
use crate::api::server::AppState; use actix_web::{ web::{self, put, Data}, HttpResponse, Scope, }; use alloy::primitives::U256; use log::warn; use shared::models::api::ApiResponse; use shared::models::node::{ComputeRequirements, Node}; use std::str::FromStr; pub(crate) async fn register_node( node: web::Js...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/api/routes/mod.rs
crates/discovery/src/api/routes/mod.rs
pub(crate) mod get_nodes; pub(crate) mod node;
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/api/routes/get_nodes.rs
crates/discovery/src/api/routes/get_nodes.rs
use crate::api::server::AppState; use actix_web::{ web::Data, web::{self}, HttpResponse, }; use alloy::primitives::U256; use shared::models::api::ApiResponse; use shared::models::node::DiscoveryNode; pub(crate) async fn get_nodes(data: Data<AppState>) -> HttpResponse { let nodes = data.node_store.get_n...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/chainsync/sync.rs
crates/discovery/src/chainsync/sync.rs
use crate::store::node_store::NodeStore; use alloy::primitives::Address; use alloy::providers::Provider as _; use alloy::providers::RootProvider; use anyhow::Error; use futures::stream::{self, StreamExt}; use log::{debug, error, info, warn}; use shared::models::node::DiscoveryNode; use shared::web3::contracts::core::bu...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/discovery/src/chainsync/mod.rs
crates/discovery/src/chainsync/mod.rs
mod sync; pub use sync::ChainSync;
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/mint_ai_token.rs
crates/dev-utils/examples/mint_ai_token.rs
use alloy::primitives::utils::Unit; use alloy::primitives::Address; use alloy::primitives::U256; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { /// Address to min...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/test_concurrent_calls.rs
crates/dev-utils/examples/test_concurrent_calls.rs
use alloy::eips::BlockId; use alloy::eips::BlockNumberOrTag; use alloy::primitives::utils::Unit; use alloy::primitives::Address; use alloy::primitives::U256; use alloy::providers::Provider; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::contracts::help...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/set_min_stake_amount.rs
crates/dev-utils/examples/set_min_stake_amount.rs
use alloy::primitives::utils::Unit; use alloy::primitives::U256; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use url::Url; #[derive(Parser)] struct Args { /// Minimum stake amount to set #[arg(short = 'm', long)] min_sta...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/whitelist_provider.rs
crates/dev-utils/examples/whitelist_provider.rs
use alloy::primitives::Address; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use url::Url; #[derive(Parser)] struct Args { /// Provider address to whitelist #[arg(short = 'a', long)] provider_address: String, /// Pri...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/submit_work.rs
crates/dev-utils/examples/submit_work.rs
use alloy::primitives::{Address, U256}; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { /// Pool ID #[arg(short = 'p', long)] pool_id: u32, /// Node a...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/eject_node.rs
crates/dev-utils/examples/eject_node.rs
use alloy::primitives::Address; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { /// Private key for transaction signing /// The address of this key must be the...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/get_node_info.rs
crates/dev-utils/examples/get_node_info.rs
use alloy::primitives::Address; use alloy::providers::RootProvider; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { /// Provider address #[arg(short = 'p', long)] provider_address: String, ...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/invalidate_work.rs
crates/dev-utils/examples/invalidate_work.rs
use alloy::primitives::U256; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { #[arg(long)] pool_id: u64, #[arg(long)] penalty: String, #[arg(long)] ...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/create_domain.rs
crates/dev-utils/examples/create_domain.rs
use alloy::primitives::Address; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { /// Domain name to create #[arg(short = 'd', long)] domain_name: String, ...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/compute_pool.rs
crates/dev-utils/examples/compute_pool.rs
use alloy::primitives::Address; use alloy::primitives::U256; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::contracts::implementations::rewards_distributor_contract::RewardsDistributor; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/start_compute_pool.rs
crates/dev-utils/examples/start_compute_pool.rs
use alloy::primitives::U256; use clap::Parser; use eyre::Result; use shared::web3::contracts::core::builder::ContractBuilder; use shared::web3::wallet::Wallet; use url::Url; #[derive(Parser)] struct Args { /// Private key for transaction signing /// The address of this key will be the creator of the compute po...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/dev-utils/examples/transfer_eth.rs
crates/dev-utils/examples/transfer_eth.rs
use alloy::{ network::TransactionBuilder, primitives::utils::format_ether, primitives::Address, primitives::U256, providers::Provider, rpc::types::TransactionRequest, }; use clap::Parser; use eyre::Result; use shared::web3::wallet::Wallet; use std::str::FromStr; use url::Url; #[derive(Parser)] struct Args { ...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/worker/build.rs
crates/worker/build.rs
fn main() { // If WORKER_VERSION is set during the build (e.g., in CI), // pass it to the rustc compiler. if let Ok(version) = std::env::var("WORKER_VERSION") { println!("cargo:rustc-env=WORKER_VERSION={version}"); } if let Ok(rpc_url) = std::env::var("WORKER_RPC_URL") { println!("ca...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/worker/src/lib.rs
crates/worker/src/lib.rs
mod checks; mod cli; mod console; mod docker; mod metrics; mod operations; mod p2p; mod services; mod state; mod utils; pub use cli::execute_command; pub use cli::Cli; pub use utils::logging::setup_logging; pub type TaskHandles = std::sync::Arc<tokio::sync::Mutex<Vec<tokio::task::JoinHandle<()>>>>;
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/worker/src/main.rs
crates/worker/src/main.rs
use clap::Parser; use std::panic; use std::sync::Arc; use tokio::signal::unix::{signal, SignalKind}; use tokio::sync::Mutex; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use worker::TaskHandles; use worker::{execute_command, setup_logging, Cli}; #[tokio::main] async fn main() -> Result<(), Bo...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false
PrimeIntellect-ai/protocol
https://github.com/PrimeIntellect-ai/protocol/blob/d389f2035ec2c3c485c6b3e270625f86c7609d50/crates/worker/src/services/discovery_updater.rs
crates/worker/src/services/discovery_updater.rs
use crate::services::discovery::DiscoveryService; use crate::state::system_state::SystemState; use log::{debug, error, info}; use shared::models::node::Node; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use tokio::time::{sleep, Duration}; use tokio_util::sync::CancellationToken; const INITIAL_UPD...
rust
Apache-2.0
d389f2035ec2c3c485c6b3e270625f86c7609d50
2026-01-04T20:18:07.676063Z
false