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 |
|---|---|---|---|---|---|---|---|---|
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/src/proto/mod.rs | src/proto/mod.rs | //! This module contains a correct and complete implementation of [RFC6455](https://datatracker.ietf.org/doc/html/rfc6455).
//!
//! Any extensions are currently not implemented.
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) use self::types::Role;
pub use self::{
error::ProtocolError,
stream::We... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/tests/pr102_regression.rs | tests/pr102_regression.rs | #![cfg(all(feature = "client", feature = "server"))]
use std::time::Duration;
use futures_util::{SinkExt, StreamExt};
use tokio::{io::duplex, time::timeout};
use tokio_websockets::{ClientBuilder, Message, ServerBuilder};
#[tokio::test]
async fn test_pr102_regression() {
let (tx, rx) = duplex(64);
// Create a... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/tests/issue106.rs | tests/issue106.rs | #![cfg(feature = "client")]
use std::{
io::Result,
pin::Pin,
sync::{
Arc,
atomic::{AtomicUsize, Ordering},
},
task::{Context, Poll, Wake},
};
use futures_util::{SinkExt, StreamExt};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_websockets::{ClientBuilder, Message};
st... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/tests/pr117_regression.rs | tests/pr117_regression.rs | #![cfg(all(feature = "client", feature = "server"))]
use futures_util::{SinkExt, StreamExt, stream};
use tokio::io::{AsyncRead, AsyncWrite, duplex};
use tokio_websockets::{ClientBuilder, Message, ServerBuilder};
const NUM_MSG: usize = 1024;
const MESSAGE: &str = "test message";
#[tokio::test]
async fn test_pr117_reg... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/tests/cancellation_safety.rs | tests/cancellation_safety.rs | #![cfg(feature = "server")]
use std::{
io,
pin::Pin,
task::{Context, Poll},
};
use futures_util::{FutureExt, StreamExt, task::noop_waker_ref};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_websockets::ServerBuilder;
struct SuperSlow {
buf: Vec<u8>,
delays: u8,
}
impl SuperSlow {
... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/tests/utf8_validation.rs | tests/utf8_validation.rs | // Autobahn does test all edge cases for UTF-8 validation - except one:
// When a text message is split into multiple frames and the invalid UTF-8 is
// part of a continuation frame, it only expects clients to fail fast after the
// entire frame has been received. We should, however, fail immediately.
#![cfg(feature = ... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/fuzz/fuzz_targets/stream.rs | fuzz/fuzz_targets/stream.rs | #![no_main]
extern crate tokio_websockets;
use std::{
convert::TryFrom,
future::Future,
io,
num::NonZeroUsize,
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Poll},
};
use arbitrary::Arbitrary;
use futures::{pin_mut, stream::StreamExt, FutureExt, SinkExt};
use libfuzzer_sys::fuzz_target;
u... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/utf8_benchmark_client.rs | examples/utf8_benchmark_client.rs | // This is a benchmark for utf-8 validation in tokio-websockets.
// In order to properly be able to benchmark a WebSocket library, this client
// must not use a WebSocket library. In the end, we want to benchmark the
// server, not the client.
//
// The client sends a single WebSocket message over and over again. This ... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/utf8_benchmark_server.rs | examples/utf8_benchmark_server.rs | use std::fs::remove_file;
use futures_util::{SinkExt, StreamExt};
use tokio::net::UnixListener;
use tokio_websockets::{Error, Limits, ServerBuilder};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Error> {
// The socket might still exist from an earlier run!
let _ = remove_file("/tmp/... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/autobahn_server.rs | examples/autobahn_server.rs | use std::net::SocketAddr;
use futures_util::{SinkExt, StreamExt};
use tokio::net::{TcpListener, TcpStream};
use tokio_websockets::{Error, Limits, ServerBuilder};
async fn accept_connection(stream: TcpStream) {
if let Err(e) = handle_connection(stream).await {
match e {
Error::Protocol(_) => ()... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/echo_server.rs | examples/echo_server.rs | use std::net::SocketAddr;
use futures_util::{SinkExt, StreamExt};
use tokio::net::TcpListener;
use tokio_websockets::{Config, Error, Limits, ServerBuilder};
const PORT: u16 = 3000;
async fn run() -> Result<(), Error> {
let addr = SocketAddr::from(([127, 0, 0, 1], PORT));
let listener = TcpListener::bind(addr... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/client.rs | examples/client.rs | use futures_util::{SinkExt, StreamExt};
use http::Uri;
use tokio_websockets::{ClientBuilder, Error, Message};
#[tokio::main]
async fn main() -> Result<(), Error> {
let uri = Uri::from_static("ws://127.0.0.1:3000");
let (mut client, _) = ClientBuilder::from_uri(uri).connect().await?;
client.send(Message::t... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/native_tls_self_signed_client.rs | examples/native_tls_self_signed_client.rs | use futures_util::{SinkExt, StreamExt};
use http::Uri;
use tokio_native_tls::native_tls::{Certificate, TlsConnector};
use tokio_websockets::{ClientBuilder, Error};
#[tokio::main]
async fn main() -> Result<(), Error> {
let uri = Uri::from_static("wss://127.0.0.1:8080");
let bytes = std::fs::read("certs/localhos... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/server.rs | examples/server.rs | use futures_util::{SinkExt, StreamExt};
use tokio::net::TcpListener;
use tokio_websockets::{Error, ServerBuilder};
#[tokio::main]
async fn main() -> Result<(), Error> {
let listener = TcpListener::bind("127.0.0.1:3000").await?;
loop {
let (conn, _) = listener.accept().await?;
let (_request, mu... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/rustls_server.rs | examples/rustls_server.rs | use std::{
fs::File,
io::{self, BufReader},
net::SocketAddr,
sync::Arc,
};
use futures_util::SinkExt;
use rustls_pemfile::{certs, pkcs8_private_keys};
use rustls_pki_types::{CertificateDer, PrivateKeyDer};
use tokio::net::TcpListener;
use tokio_rustls::{TlsAcceptor, rustls};
use tokio_websockets::Messa... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
Gelbpunkt/tokio-websockets | https://github.com/Gelbpunkt/tokio-websockets/blob/618599d15e9ee2a9a7191d081a56d90eae4a811a/examples/autobahn_client.rs | examples/autobahn_client.rs | use std::str::FromStr;
use futures_util::{SinkExt, StreamExt};
use http::Uri;
use tokio_websockets::{ClientBuilder, Connector, Error, Limits};
async fn get_case_count() -> Result<u32, Error> {
let uri = Uri::from_static("ws://localhost:9001/getCaseCount");
let (mut stream, _) = ClientBuilder::from_uri(uri)
... | rust | MIT | 618599d15e9ee2a9a7191d081a56d90eae4a811a | 2026-01-04T20:19:32.035255Z | false |
ha-shine/rustagram | https://github.com/ha-shine/rustagram/blob/37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297/src/producer.rs | src/producer.rs | extern crate image;
extern crate rustagram;
use rustagram::filters::{RustagramFilter};
use rustagram::filters::FilterType::*;
fn main() {
let img = image::open("test.jpg").unwrap();
let out = img.to_rgba().apply_filter(NineTeenSeventySeven);
out.save("output/NineTeenSeventySeven.jpg").unwrap();
let o... | rust | Unlicense | 37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297 | 2026-01-04T20:19:29.999195Z | false |
ha-shine/rustagram | https://github.com/ha-shine/rustagram/blob/37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297/src/lib.rs | src/lib.rs | extern crate image;
pub mod filters;
mod rustaops;
use filters::{FilterType};
pub fn validate_filter_type(filter: &str, filter_strings: &Vec<&str>, filter_types: &Vec<FilterType>) -> Result<FilterType, &'static str> {
let search_result = filter_strings.iter().enumerate().find(|f| &filter == f.1);
match searc... | rust | Unlicense | 37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297 | 2026-01-04T20:19:29.999195Z | false |
ha-shine/rustagram | https://github.com/ha-shine/rustagram/blob/37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297/src/filters.rs | src/filters.rs | extern crate image;
use image::{RgbaImage, ConvertBuffer};
use image::imageops;
use rustaops;
#[derive(Clone)]
pub enum FilterType {
NineTeenSeventySeven,
Aden,
Brannan,
Brooklyn,
Clarendon,
Earlybird,
Gingham,
Hudson,
Inkwell,
Kelvin,
Lark,
Lofi,
Maven,
Mayfair... | rust | Unlicense | 37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297 | 2026-01-04T20:19:29.999195Z | false |
ha-shine/rustagram | https://github.com/ha-shine/rustagram/blob/37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297/src/main.rs | src/main.rs | extern crate image;
extern crate rustagram;
#[macro_use]
extern crate clap;
use rustagram::filters::{RustagramFilter};
use rustagram::filters::FilterType::*;
use std::process;
fn main() {
let filter_strings = vec![
"1977", "aden", "brannan", "brooklyn", "clarendon", "earlybird", "gingham", "hudson",
... | rust | Unlicense | 37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297 | 2026-01-04T20:19:29.999195Z | false |
ha-shine/rustagram | https://github.com/ha-shine/rustagram/blob/37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297/src/rustaops/mod.rs | src/rustaops/mod.rs | extern crate image;
use image::{GenericImage, ImageBuffer, Pixel, Rgba};
use image::math::utils::clamp;
mod blend;
pub fn brighten_by_percent<I, P>(image: &I, value: f32) -> ImageBuffer<P, Vec<u8>>
where I: GenericImage<Pixel=P>,
P: Pixel<Subpixel=u8> + 'static {
let (width, height) = image.dimensi... | rust | Unlicense | 37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297 | 2026-01-04T20:19:29.999195Z | false |
ha-shine/rustagram | https://github.com/ha-shine/rustagram/blob/37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297/src/rustaops/blend.rs | src/rustaops/blend.rs | use std::cmp;
#[allow(dead_code)]
pub fn compute_final_alpha(fg: &[u8; 4], bg: &[u8; 4]) -> u8 {
let fg_alpha = fg[3] as f32 / 255.0;
let bg_alpha = bg[3] as f32 / 255.0;
let final_alpha = fg_alpha + bg_alpha * (1.0 - fg_alpha);
(final_alpha * 255.0) as u8
}
#[allow(dead_code)]
pub fn blend_screen(x1:... | rust | Unlicense | 37d54cbb1f2ca26f8b1c4e1e3e6c226ae0241297 | 2026-01-04T20:19:29.999195Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/build.rs | node/build.rs | use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
fn main() {
generate_cargo_keys();
rerun_if_git_head_changed();
}
| rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/command.rs | node/src/command.rs | use contracts_parachain_runtime::Block;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, RpcEndpoint, SharedParams, S... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/chain_spec.rs | node/src/chain_spec.rs | pub mod dev;
use contracts_parachain_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT};
use cumulus_primitives_core::ParaId;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/cli.rs | node/src/cli.rs | use std::path::PathBuf;
/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),
/// Validate blocks.
CheckBlock(sc_cli::CheckBlockCmd),
/// Export blocks.
ExportBlocks(sc_cli::ExportBlocksCmd),
/// ... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/service.rs | node/src/service.rs | //! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
pub mod dev;
// std
use std::{sync::Arc, time::Duration};
use cumulus_client_cli::CollatorOptions;
// Local Runtime Types
use contracts_parachain_runtime::{
opaque::{Block, Hash},
RuntimeApi,
};
// Cumulus Imports
use cumulu... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/rpc.rs | node/src/rpc.rs | //! A collection of node-specific RPC methods.
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
//! used by Substrate nodes. This file extends those RPC definitions with
//! capabilities that are specific to this project's runtime configuration.
#![warn(missing_docs)]
use std::sync::Arc;
u... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/main.rs | node/src/main.rs | //! Substrate Parachain Node Template CLI
#![warn(missing_docs)]
mod chain_spec;
#[macro_use]
mod service;
mod cli;
mod command;
mod rpc;
fn main() -> sc_cli::Result<()> {
command::run()
}
| rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/service/dev.rs | node/src/service/dev.rs | //! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
use contracts_node_runtime::{self, opaque::Block, RuntimeApi};
use futures::FutureExt;
use sc_client_api::Backend;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, Telemet... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/node/src/chain_spec/dev.rs | node/src/chain_spec/dev.rs | use contracts_node_runtime::{AccountId, Signature, WASM_BINARY};
use sc_service::ChainType;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericCha... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/runtime/build.rs | runtime/build.rs | fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build();
}
}
| rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/runtime/src/lib.rs | runtime/src/lib.rs | #![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
mod assets_config;
mod contracts_config... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/runtime/src/contracts_config.rs | runtime/src/contracts_config.rs | use crate::{
Balance, Balances, BalancesCall, Perbill, RandomnessCollectiveFlip, Runtime, RuntimeCall,
RuntimeEvent, RuntimeHoldReason, Timestamp,
};
use frame_support::{
parameter_types,
traits::{ConstBool, ConstU32},
};
use frame_system::EnsureSigned;
pub enum AllowBalancesCall {}
impl frame_support::traits::Co... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/runtime/src/assets_config.rs | runtime/src/assets_config.rs | use crate::{AccountId, Balance, Balances, Runtime, RuntimeEvent};
use frame_support::{
parameter_types,
traits::{AsEnsureOriginWithArg, ConstU128, ConstU32},
};
use frame_system::EnsureSigned;
pub const MILLICENTS: Balance = 1_000_000_000;
pub const CENTS: Balance = 1_000 * MILLICENTS; // assume this is worth about ... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/runtime/src/revive_config.rs | runtime/src/revive_config.rs | use crate::{
Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, RuntimeEvent,
RuntimeHoldReason, Timestamp,
};
use frame_support::{
parameter_types,
traits::{ConstBool, ConstU32},
};
use frame_system::EnsureSigned;
pub enum AllowBalancesCall {}
impl frame_support::traits::Contains<RuntimeCall> for Al... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/build.rs | parachain-runtime/build.rs | #[cfg(feature = "std")]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
}
/// The wasm builder is deactivated when compiling
/// this crate for wasm to speed up the compilation.
#[cfg(not(feature = "std"))]
fn main() {}
| rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/lib.rs | parachain-runtime/src/lib.rs | #![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
mod assets_config;
mod contracts_config... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/contracts_config.rs | parachain-runtime/src/contracts_config.rs | use crate::{
Balance, Balances, BalancesCall, Perbill, RandomnessCollectiveFlip, Runtime, RuntimeCall,
RuntimeEvent, RuntimeHoldReason, Timestamp,
};
use frame_support::{
parameter_types,
traits::{ConstBool, ConstU32},
};
use frame_system::EnsureSigned;
pub enum AllowBalancesCall {}
impl frame_support::traits::Co... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/assets_config.rs | parachain-runtime/src/assets_config.rs | use crate::{AccountId, Balance, Balances, Runtime, RuntimeEvent};
use frame_support::{
parameter_types,
traits::{AsEnsureOriginWithArg, ConstU128, ConstU32},
};
use frame_system::EnsureSigned;
pub const MILLICENTS: Balance = 1_000_000_000;
pub const CENTS: Balance = 1_000 * MILLICENTS; // assume this is worth about ... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/revive_config.rs | parachain-runtime/src/revive_config.rs | use crate::{
Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, RuntimeEvent,
RuntimeHoldReason, Timestamp,
};
use frame_support::{
parameter_types,
traits::{ConstBool, ConstU32},
};
use frame_system::EnsureSigned;
pub enum AllowBalancesCall {}
impl frame_support::traits::Contains<RuntimeCall> for Al... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/xcm_config.rs | parachain-runtime/src/xcm_config.rs | use super::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use frame_support::{
parameter_types,
traits::{ConstU32, Contains, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoo... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/weights/paritydb_weights.rs | parachain-runtime/src/weights/paritydb_weights.rs | // This file is part of Substrate.
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://w... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/weights/block_weights.rs | parachain-runtime/src/weights/block_weights.rs | // This file is part of Substrate.
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://w... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/weights/mod.rs | parachain-runtime/src/weights/mod.rs | // This file is part of Substrate.
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://w... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/weights/rocksdb_weights.rs | parachain-runtime/src/weights/rocksdb_weights.rs | // This file is part of Substrate.
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://w... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
paritytech/substrate-contracts-node | https://github.com/paritytech/substrate-contracts-node/blob/f209befc88cb54ff50b7483c13d19e62213d0c60/parachain-runtime/src/weights/extrinsic_weights.rs | parachain-runtime/src/weights/extrinsic_weights.rs | // This file is part of Substrate.
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://w... | rust | Unlicense | f209befc88cb54ff50b7483c13d19e62213d0c60 | 2026-01-04T20:19:32.556120Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/lib.rs | src/lib.rs | pub mod app;
pub mod mcp;
| rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/main.rs | src/main.rs | use clap::{Parser, Subcommand};
use rusqlite::Connection;
use std::path::PathBuf;
use ghost::app::{commands, config, error::Result, logging, storage};
#[derive(Parser, Debug)]
#[command(name = "ghost")]
#[command(about = "A simple background process manager")]
#[command(
long_about = "A simple background process ... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/config.rs | src/app/config.rs | use std::path::PathBuf;
/// Configuration for Ghost application
#[derive(Debug, Clone)]
pub struct Config {
pub data_dir: PathBuf,
pub log_dir: PathBuf,
pub db_path: PathBuf,
}
impl Default for Config {
fn default() -> Self {
let data_dir = get_data_dir();
let log_dir = data_dir.join("... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/port_detector.rs | src/app/port_detector.rs | use crate::app::error::{GhostError, Result};
use std::process::Command;
use std::sync::OnceLock;
#[derive(Debug, Clone)]
pub struct ListeningPort {
pub protocol: String,
pub local_addr: String,
pub state: String,
}
// Cache the lsof availability check result
static LSOF_AVAILABLE: OnceLock<bool> = OnceLoc... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/process.rs | src/app/process.rs | use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;
use nix::unistd::setsid;
use std::fs::File;
use std::os::unix::process::CommandExt as _;
use std::path::PathBuf;
use std::process::{Child, Command, Stdio};
use uuid::Uuid;
#[derive(Debug, Clone)]
pub struct ProcessInfo {
pub id: String,
pub pid: u32,
... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/storage.rs | src/app/storage.rs | pub mod cleanup;
pub mod database;
pub mod task;
pub mod task_repository;
pub mod task_status;
// Re-export for backward compatibility
pub use cleanup::{cleanup_old_tasks, cleanup_tasks_by_criteria, get_cleanup_candidates};
pub use database::{init_database, init_database_with_config};
pub use task::Task;
pub use task_... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/error.rs | src/app/error.rs | #[derive(Debug, thiserror::Error)]
pub enum GhostError {
// Process-related errors
#[error("Process spawn failed: {message}")]
ProcessSpawn { message: String },
#[error("Process operation failed: {message}")]
ProcessOperation { message: String },
#[error("Log file creation failed: {path} - {so... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/display.rs | src/app/display.rs | use crate::app::storage::Task;
/// Display a list of tasks in a formatted table
pub fn print_task_list(tasks: &[Task]) {
if tasks.is_empty() {
println!("No tasks found.");
return;
}
print_table_header();
for task in tasks {
let command_display = format_command_truncated(&task.... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/commands.rs | src/app/commands.rs | use std::path::PathBuf;
use crate::app::{config, display, error, error::Result, helpers, process, storage};
use rusqlite::Connection;
/// Run a command in the background
pub fn spawn(
conn: &Connection,
command: Vec<String>,
cwd: Option<PathBuf>,
env: Vec<String>,
show_output: bool,
) -> Result<pr... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/mod.rs | src/app/mod.rs | pub mod commands;
pub mod config;
pub mod display;
pub mod error;
pub mod helpers;
pub mod logging;
pub mod port_detector;
pub mod process;
pub mod process_state;
pub mod storage;
pub mod tui;
| rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/logging.rs | src/app/logging.rs | use std::path::Path;
use tracing_appender::non_blocking::WorkerGuard;
use tracing_rolling_file::RollingFileAppenderBase;
use tracing_subscriber::fmt::format::FmtSpan;
/// Initialize file logger with rolling file appender
///
/// Creates a rolling file appender that:
/// - Writes to `ghost.log` in the specified directo... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/process_state.rs | src/app/process_state.rs | use crate::app::{
process,
storage::{Task, TaskStatus},
};
/// Check and update the status of a single task based on process existence
pub fn update_task_status_if_needed(task: &mut Task) -> bool {
if task.status == TaskStatus::Running && !process::exists(task.pid) {
task.status = TaskStatus::Exite... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/storage/task_status.rs | src/app/storage/task_status.rs | use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum TaskStatus {
Running,
Exited,
Killed,
Unknown,
}
impl std::fmt::Display for TaskStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", s... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/storage/task_repository.rs | src/app/storage/task_repository.rs | use std::path::Path;
use rusqlite::{Connection, Result as SqliteResult, Row};
use super::task::Task;
use super::task_status::TaskStatus;
use crate::app::error::Result;
use crate::app::process_state;
/// Insert a new task into the database
#[allow(clippy::too_many_arguments)]
pub fn insert_task(
conn: &Connection... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/storage/database.rs | src/app/storage/database.rs | use crate::app::error::Result;
use rusqlite::Connection;
/// Initialize schema on an existing connection (for testing)
pub(crate) fn init_schema(conn: &Connection) -> Result<()> {
// Create tasks table
conn.execute(
r#"
CREATE TABLE IF NOT EXISTS tasks (
id TEXT PRIMARY KEY,
... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/storage/cleanup.rs | src/app/storage/cleanup.rs | use rusqlite::Connection;
use super::task::Task;
use super::task_repository::{row_to_task, update_task_status_by_process_check};
use super::task_status::TaskStatus;
use crate::app::error::Result;
/// Clean up old tasks (legacy function)
pub fn cleanup_old_tasks(conn: &Connection, days: u64) -> Result<usize> {
let... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/storage/task.rs | src/app/storage/task.rs | use super::task_status::TaskStatus;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct Task {
pub id: String,
pub pid: u32,
pub pgid: Option<i32>,
pub command: String, // JSON serialized Vec<String>
pub env: Option<String>, // JSON serialized environment variables
pub ... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/helpers/file_watcher.rs | src/app/helpers/file_watcher.rs | use std::path::PathBuf;
use std::time::Duration;
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, AsyncSeekExt, BufReader};
use tokio::sync::mpsc;
use crate::app::{error, error::Result};
/// Follow a log file and print new lines as they appear (tail -f behavior)
pub async fn follow_log_file(file_path: &PathBuf) ... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/helpers/task_validation.rs | src/app/helpers/task_validation.rs | use crate::app::{error, error::Result, storage};
/// Validate that a task is in running state
pub fn validate_task_running(task: &storage::Task) -> Result<()> {
if task.status != storage::TaskStatus::Running {
return Err(error::GhostError::TaskOperation {
task_id: task.id.clone(),
m... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/helpers/command_parser.rs | src/app/helpers/command_parser.rs | //! Command string parser for multi-command execution
//!
//! Parses command strings like "sleep 10" into ["sleep", "10"]
use crate::app::error::{GhostError, Result};
/// Parse a command string into command name and arguments
///
/// # Examples
/// - "sleep 10" -> ["sleep", "10"]
/// - "echo 'hello world'" -> ["echo"... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/helpers/time.rs | src/app/helpers/time.rs | use std::time::{SystemTime, UNIX_EPOCH};
/// Get current Unix timestamp in seconds
pub fn now_timestamp() -> i64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs() as i64
}
| rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/helpers/mod.rs | src/app/helpers/mod.rs | pub mod command_parser;
pub mod file_watcher;
pub mod task_validation;
pub mod time;
// Re-export for backward compatibility
pub use command_parser::parse_command;
pub use file_watcher::follow_log_file;
pub use task_validation::validate_task_running;
pub use time::now_timestamp;
| rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/tui/app.rs | src/app/tui/app.rs | use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use ratatui::{Frame, layout::Rect};
use rusqlite::Connection;
use std::collections::HashMap;
use std::fs;
use std::process::Child;
use std::time::SystemTime;
use tui_scrollview::ScrollViewState;
use super::log_viewer_scrollview::LogViewerScrollWidget;
use super:... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/tui/process_details.rs | src/app/tui/process_details.rs | use ratatui::{
Frame,
layout::{Alignment, Constraint, Direction, Layout, Rect, Size},
style::{Color, Modifier, Style},
symbols,
text::{Line, Span},
widgets::{Block, Borders, Paragraph, Wrap},
};
use tui_scrollview::{ScrollView, ScrollViewState, ScrollbarVisibility};
use crate::app::port_detecto... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/tui/task_list.rs | src/app/tui/task_list.rs | use ratatui::{
Frame,
layout::{Constraint, Rect},
style::{Color, Style},
widgets::{Block, Borders, Cell, Row, StatefulWidget, Table, TableState, Widget},
};
// Layout constants
const ID_COLUMN_WIDTH: u16 = 38; // Full UUID (36 chars) + 2 for padding
const PID_COLUMN_WIDTH: u16 = 8;
const STATUS_COLUMN_... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/tui/table_state_scroll.rs | src/app/tui/table_state_scroll.rs | use ratatui::widgets::TableState;
/// Wrapper for managing table scrolling with TableState
#[derive(Debug, Default)]
pub struct TableScroll {
state: TableState,
total_items: usize,
}
impl TableScroll {
pub fn new() -> Self {
let mut state = TableState::default();
state.select(Some(0));
... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/tui/log_viewer_scrollview.rs | src/app/tui/log_viewer_scrollview.rs | use ratatui::{
buffer::Buffer,
layout::{Constraint, Layout, Rect, Size},
style::{Color, Style},
symbols,
text::{Line, Span},
widgets::{Block, Borders, Paragraph, StatefulWidget, Widget},
};
use serde_json;
use tui_scrollview::{ScrollView, ScrollViewState};
use crate::app::storage::task::Task;
... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/app/tui/mod.rs | src/app/tui/mod.rs | pub mod app;
pub mod log_viewer_scrollview;
pub mod process_details;
pub mod table_state_scroll;
pub mod task_list;
use self::table_state_scroll::TableScroll;
use crate::app::storage::task::Task;
pub struct App {
pub tasks: Vec<Task>,
pub selected_index: usize,
pub filter: TaskFilter,
pub table_scroll... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/src/mcp/mod.rs | src/mcp/mod.rs | use async_trait::async_trait;
use rust_mcp_sdk::macros::{JsonSchema, mcp_tool};
use rust_mcp_sdk::mcp_server::{ServerHandler, server_runtime};
use rust_mcp_sdk::schema::schema_utils::CallToolError;
use rust_mcp_sdk::schema::{
CallToolRequest, CallToolResult, Implementation, InitializeResult, LATEST_PROTOCOL_VERSION... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/tests/tcp_server_helper.rs | tests/tcp_server_helper.rs | use std::net::TcpListener;
use std::thread;
use std::time::Duration;
fn main() {
// Get port from command line args, default to 0 (random port)
let port = std::env::args()
.nth(1)
.and_then(|s| s.parse::<u16>().ok())
.unwrap_or(0);
let listener =
TcpListener::bind(format!("... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/tests/mcp_server_tests.rs | tests/mcp_server_tests.rs | use std::sync::{Arc, Mutex};
use std::time::Duration;
use async_trait::async_trait;
use ghost::app::config::Config;
use ghost::app::storage::{self, Task, TaskStatus};
use ghost::mcp::GhostServerHandler;
use rusqlite::Connection;
use rust_mcp_sdk::McpServer;
use rust_mcp_sdk::auth::AuthInfo;
use rust_mcp_sdk::mcp_serve... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/tests/port_detector_test.rs | tests/port_detector_test.rs | use ghost::app::port_detector::detect_listening_ports;
use std::process::Command;
use std::thread;
use std::time::Duration;
#[test]
fn test_detect_listening_ports_with_server() {
// Compile the TCP server helper
let output = Command::new("rustc")
.args([
"tests/tcp_server_helper.rs",
... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | false |
skanehira/ghost | https://github.com/skanehira/ghost/blob/2608a5ac4d31e61433a039387325199a22701da6/tests/tui_tests.rs | tests/tui_tests.rs | use ghost::app::config::Config;
use ghost::app::storage::task::Task;
use ghost::app::storage::task_status::TaskStatus;
use ghost::app::tui::{App, TaskFilter, ViewMode};
use pretty_assertions::assert_eq;
use ratatui::{Terminal, backend::TestBackend};
use std::fs;
use tempfile::TempDir;
/// Helper function to load expec... | rust | MIT | 2608a5ac4d31e61433a039387325199a22701da6 | 2026-01-04T20:19:35.234323Z | true |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/lib.rs | src/lib.rs | #![cfg_attr(not(any(test, feature = "std")), no_std)]
mod codes;
pub mod command;
pub mod negotiation;
pub mod parser;
#[cfg(feature = "std")]
mod serialport_conversions;
#[cfg(feature = "std")]
pub mod server;
pub mod subnegotiation;
// Public API
pub use command::Command;
pub use negotiation::Negotiation;
pub use p... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/command.rs | src/command.rs | use crate::codes;
pub const SIZE: usize = 2;
// Telnet commands without the ones related to negotiation and subnegotiation,
// defined here: https://www.rfc-editor.org/rfc/rfc854.txt
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Command {
NoOp,
DataMark,
Break,
InterruptProcess,
AbortOutpu... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/parser.rs | src/parser.rs | use crate::{codes, command, negotiation, subnegotiation, Command, Negotiation, Subnegotiation};
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Event {
Data(u8),
Command(Command),
Negotiation(Negotiation),
Subnegotiation(Subnegotiation),
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Er... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/codes.rs | src/codes.rs | // Telnet command codes needed for command, negotiation and
// subnegotiation serializing/deserializing
pub const IAC: u8 = 255;
pub const WILL: u8 = 251;
pub const WONT: u8 = 252;
pub const DO: u8 = 253;
pub const DONT: u8 = 254;
pub const SB: u8 = 250;
pub const SE: u8 = 240;
pub const COM_PORT_OPTION: u8 = 44;
| rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/serialport_conversions.rs | src/serialport_conversions.rs | use serialport::{DataBits, FlowControl, Parity, StopBits};
// Required functions for conversions between serialport Enums and rfc2217 option values
pub(crate) const fn data_bits_to_u8(data_bits: DataBits) -> u8 {
match data_bits {
DataBits::Five => 5,
DataBits::Six => 6,
DataBits::Seven => ... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/subnegotiation.rs | src/subnegotiation.rs | use crate::codes;
pub const MAX_DATA_SIZE: usize = 256;
pub const NONDATA_SIZE: usize = 6;
pub const MAX_SIZE: usize = MAX_DATA_SIZE + NONDATA_SIZE;
// RFC2217 subnegotiation options, defined here: https://www.rfc-editor.org/rfc/rfc2217.html
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Subnegotiation {
S... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/server.rs | src/server.rs | use crate::serialport_conversions::*;
use crate::{
codes, negotiation, parser, subnegotiation, Command, Negotiation, Parser, Subnegotiation,
};
use serialport::{ClearBuffer, FlowControl, SerialPort};
use std::io::{self, BufWriter, Read, Write};
use std::net::{TcpListener, TcpStream, ToSocketAddrs};
#[derive(Debug)... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/negotiation.rs | src/negotiation.rs | use crate::codes;
pub const SIZE: usize = 3;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct Negotiation {
pub intent: Intent,
pub option: Option,
}
// Telnet options
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Option {
Binary,
Echo,
SuppressGoAhead,
ComPort,
Unsupported... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/src/bin/server.rs | src/bin/server.rs | use clap::Parser;
use std::net::IpAddr;
use rfc2217_rs::Server;
#[derive(Parser, Debug)]
struct Args {
#[clap(long = "serial_port", short = 'p', default_value = "/dev/ttyUSB0")]
serial_port: String,
#[clap(long = "address", short = 'a', default_value = "127.0.0.1")]
address: IpAddr,
#[clap(long = "... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
esp-rs/rfc2217-rs | https://github.com/esp-rs/rfc2217-rs/blob/6dd355b57726fcf211a5f06fb866eafda176c431/tests/unit_tests.rs | tests/unit_tests.rs | use parser::{Error, Event};
use rfc2217_rs::*;
#[test]
fn test_negotiation() {
let mut neg: [u8; 3] = [0; negotiation::SIZE];
Negotiation {
intent: negotiation::Intent::Will,
option: negotiation::Option::Binary,
}
.serialize(&mut neg);
let mut parser = Parser::new();
let mut r... | rust | Apache-2.0 | 6dd355b57726fcf211a5f06fb866eafda176c431 | 2026-01-04T20:19:28.343083Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/lib.rs | src/lib.rs | #![cfg_attr(not(test), no_std)]
#![warn(
missing_debug_implementations,
// missing_docs, // some variants still missing docs
missing_copy_implementations,
rust_2018_idioms,
unreachable_pub,
non_snake_case,
non_upper_case_globals
)]
#![allow(clippy::cognitive_complexity)]
#![deny(rustdoc::bro... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/encoder.rs | src/encoder.rs | //! Encodable trait & Encoder
use alloc::vec::Vec;
use crate::error::{EncodeError, EncodeResult};
/// A trait for types which are deserializable to DHCP binary formats
pub trait Encodable {
/// encode type to buffer in Encoder
fn encode(&self, e: &mut Encoder<'_>) -> EncodeResult<()>;
/// encode this ty... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/decoder.rs | src/decoder.rs | //! Decodable trait & Decoder
use hickory_proto::{
rr::Name,
serialize::binary::{BinDecodable, BinDecoder},
};
use crate::error::{DecodeError, DecodeResult};
use alloc::{borrow::ToOwned, ffi::CString, string::String, vec::Vec};
use core::{
array::TryFromSliceError,
convert::TryInto,
ffi::CStr,
... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/error.rs | src/error.rs | //! Error types for Encoding/Decoding
use alloc::boxed::Box;
use thiserror::Error;
/// Convenience type for decode errors
pub type DecodeResult<T> = Result<T, DecodeError>;
/// Returned from types that decode
#[derive(Error, Debug)]
pub enum DecodeError {
/// add overflow
#[error("decoder checked_add failed"... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/v4/opcode.rs | src/v4/opcode.rs | use crate::{
decoder::{Decodable, Decoder},
encoder::{Encodable, Encoder},
error::{DecodeResult, EncodeResult},
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Opcode of Message
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/v4/bulk_query.rs | src/v4/bulk_query.rs | use core::fmt;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Lease query data source flags
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Default, Clone, PartialEq, Eq)]
pub struct DataSourceFlags(u8);
impl fmt::Debug for DataSourceFlags {
fn fmt(&self, f: &mut... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/v4/htype.rs | src/v4/htype.rs | use crate::{
decoder::{Decodable, Decoder},
encoder::{Encodable, Encoder},
error::{DecodeResult, EncodeResult},
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Hardware type of message
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Copy, Hash, Clone, P... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/v4/flags.rs | src/v4/flags.rs | use core::fmt;
use crate::{
decoder::{Decodable, Decoder},
encoder::{Encodable, Encoder},
error::{DecodeResult, EncodeResult},
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Represents available flags on message
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[deriv... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/v4/relay.rs | src/v4/relay.rs | //! # relay
use alloc::{collections::BTreeMap, vec::Vec};
use core::{fmt, net::Ipv4Addr};
use crate::{Decodable, Encodable};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Collection of relay agent information
///
/// You can create/modify it, then insert into a message opts section
/// in [`Dhcp... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | false |
bluecatengineering/dhcproto | https://github.com/bluecatengineering/dhcproto/blob/b4ea30defc01e7ae66e7075d6a0533d9bb9503dc/src/v4/options.rs | src/v4/options.rs | use alloc::{
borrow::Cow,
collections::BTreeMap,
string::{String, ToString},
vec::Vec,
};
use core::{iter, net::Ipv4Addr};
use crate::{
decoder::{Decodable, Decoder},
encoder::{Encodable, Encoder},
error::{DecodeResult, EncodeResult},
v4::bulk_query,
v4::{fqdn, relay},
};
use hicko... | rust | MIT | b4ea30defc01e7ae66e7075d6a0533d9bb9503dc | 2026-01-04T20:19:33.979507Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.