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 |
|---|---|---|---|---|---|---|---|---|
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_client/src/lib.rs | rpcx_client/src/lib.rs | pub mod client;
pub mod discovery;
pub mod selector;
pub mod xclient;
pub use client::*;
pub use discovery::*;
pub use selector::*;
pub use xclient::*;
use async_trait::async_trait;
use rpcx_protocol::{CallFuture, Metadata, Result, RpcxParam};
#[async_trait]
pub trait RpcxClient {
fn call<T>(
&mut self,... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_client/src/client.rs | rpcx_client/src/client.rs | use std::{
cell::RefCell,
collections::HashMap,
error::Error as StdError,
io::{BufReader, BufWriter, Write},
net::{Shutdown, SocketAddr, TcpStream},
sync::{
atomic::{AtomicU64, Ordering},
mpsc::{self, Receiver, SendError, Sender},
Arc, Mutex,
},
thread,
time::... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_client/src/xclient.rs | rpcx_client/src/xclient.rs | #![allow(non_snake_case)]
use std::collections::HashMap;
use super::selector::ClientSelector;
use super::{
client::{Client, Opt},
RpcxClient,
};
use rpcx_protocol::{call::*, CallFuture, Error, ErrorKind, Metadata, Result, RpcxParam};
use std::{
boxed::Box,
cell::RefCell,
sync::{Arc, Mutex, RwLoc... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_client/src/selector.rs | rpcx_client/src/selector.rs | use qstring::QString;
use rand::{prelude::*, Rng};
use rpcx_protocol::{RpcxParam, SerializeType};
use std::{
collections::HashMap,
sync::{Arc, RwLock},
};
use weighted_rs::*;
pub trait ClientSelector {
fn select(&mut self, service_path: &str, service_method: &str, args: &dyn RpcxParam) -> String;
fn u... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx/src/lib.rs | rpcx/src/lib.rs | pub use rpcx_client::*;
pub use rpcx_derive::*;
pub use rpcx_protocol::*;
pub use rpcx_server::*;
| rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_derive/src/lib.rs | rpcx_derive/src/lib.rs | #![recursion_limit = "128"]
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
#[proc_macro_derive(RpcxParam)]
pub fn rpcx_param(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let name = input.ident;
... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_protocol/src/lib.rs | rpcx_protocol/src/lib.rs | pub mod call;
pub mod error;
pub mod message;
pub use call::*;
pub use error::*;
pub use message::*;
| rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_protocol/src/call.rs | rpcx_protocol/src/call.rs | use crate::Result;
use std::{
cell::RefCell,
fmt::Debug,
future::Future,
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Poll, Waker},
};
use crate::SerializeType;
use bytes::BytesMut;
use super::Error;
pub trait RpcxParam: Debug {
fn into_bytes(&self, st: SerializeType) -> Result<Vec<u8>... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_protocol/src/error.rs | rpcx_protocol/src/error.rs | use std::{convert::From, error, fmt, result, str};
pub type Result<T> = result::Result<T, Error>;
pub struct Error {
repr: Repr,
}
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.repr, f)
}
}
enum Repr {
Other(String),
Simple(E... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/rpcx_protocol/src/message.rs | rpcx_protocol/src/message.rs | use byteorder::{BigEndian, ByteOrder};
use enum_primitive_derive::Primitive;
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
use num_traits::{FromPrimitive, ToPrimitive};
use strum_macros::{Display, EnumIter, EnumString};
use std::{
cell::RefCell,
collections::hash_map::HashMap,
io::{Read, Wr... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/test_suite/tests/test_xclient.rs | test_suite/tests/test_xclient.rs | #[cfg(test)]
mod tests {
use mul_model::{ArithAddArgs, ArithAddReply};
use rpcx::*;
use std::{
collections::HashMap,
net::{SocketAddr, TcpListener},
os::unix::io::AsRawFd,
thread,
};
fn add(args: ArithAddArgs) -> ArithAddReply {
ArithAddReply { c: args.a + a... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/server_register/src/main.rs | examples/server_register/src/main.rs | use mul_model::{ArithAddArgs, ArithAddReply};
use rpcx::*;
fn test(args: ArithAddArgs) -> ArithAddReply {
ArithAddReply { c: args.a + args.b }
}
fn main() {
let mut rpc_server = Server::new("0.0.0.0:8972".to_owned(), 0);
register_func!(
rpc_server,
"Arith",
"Add",
test,
... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/server_mul/src/main.rs | examples/server_mul/src/main.rs | use mul_model::{ArithAddArgs, ArithAddReply};
use rpcx::*;
fn add(args: ArithAddArgs) -> ArithAddReply {
ArithAddReply { c: args.a + args.b }
}
fn mul(args: ArithAddArgs) -> ArithAddReply {
ArithAddReply { c: args.a * args.b }
}
fn main() {
let mut rpc_server = Server::new("0.0.0.0:8972".to_owned(), 0);
... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/mul_model/src/lib.rs | examples/mul_model/src/lib.rs | use std::error::Error as StdError;
use rmp_serde as rmps;
use serde::{Deserialize, Serialize};
use rpcx::*;
#[derive(RpcxParam, Default, Debug, Copy, Clone, Serialize, Deserialize)]
pub struct ArithAddArgs {
#[serde(rename = "A")]
pub a: u64,
#[serde(rename = "B")]
pub b: u64,
}
#[derive(RpcxParam, D... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/client_call_mul/src/main.rs | examples/client_call_mul/src/main.rs | use std::collections::hash_map::HashMap;
use mul_model::*;
use rpcx::{Client, CompressType, Result, SerializeType};
pub fn main() {
let mut c: Client = Client::new("127.0.0.1:8972");
c.start().map_err(|err| println!("{}", err)).unwrap();
c.opt.serialize_type = SerializeType::JSON;
c.opt.compress_type ... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/xclient_call_mul/src/main.rs | examples/xclient_call_mul/src/main.rs | use std::collections::hash_map::HashMap;
use mul_model::*;
use rpcx::*;
pub fn main() {
let mut servers = HashMap::new();
servers.insert("tcp@127.0.0.1:8972".to_owned(), "".to_owned());
let selector = RandomSelector::new();
let disc = StaticDiscovery::new();
disc.add_selector(&selector);
disc... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/protobuf/server_mul/src/main.rs | examples/protobuf/server_mul/src/main.rs | use mul_model_proto::{ProtoArgs, ProtoReply};
use rpcx::*;
fn add(args: ProtoArgs) -> ProtoReply {
let mut rt: ProtoReply = Default::default();
rt.set_C(args.A + args.B);
rt
}
fn mul(args: ProtoArgs) -> ProtoReply {
let mut rt: ProtoReply = Default::default();
rt.set_C(args.A * args.B);
rt
}
... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/protobuf/client_call_mul/src/main.rs | examples/protobuf/client_call_mul/src/main.rs | use std::collections::hash_map::HashMap;
use mul_model_proto::*;
use rpcx::{Client, CompressType, Result, SerializeType};
pub fn main() {
let mut c: Client = Client::new("127.0.0.1:8972");
c.start().map_err(|err| println!("{}", err)).unwrap();
c.opt.serialize_type = SerializeType::Protobuf;
c.opt.comp... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/protobuf/mul_model_proto/build.rs | examples/protobuf/mul_model_proto/build.rs | use protoc_rust::Customize;
fn main() {
// protoc_rust::run(protoc_rust::Args {
// out_dir: "src/",
// input: &["protos/arith.proto"],
// includes: &["protos"],
// customize: Customize {
// // serde_derive_cfg: None,
// // serde_derive: Some(true),
// ... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/protobuf/mul_model_proto/src/arith.rs | examples/protobuf/mul_model_proto/src/arith.rs | // This file is generated by rust-protobuf 2.28.0. Do not edit
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#!... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/protobuf/mul_model_proto/src/lib.rs | examples/protobuf/mul_model_proto/src/lib.rs | pub mod arith;
pub use arith::*;
use protobuf::Message;
use rpcx::{Error, ErrorKind, Result, RpcxParam, SerializeType};
impl RpcxParam for ProtoArgs {
fn into_bytes(&self, st: SerializeType) -> Result<Vec<u8>> {
match st {
SerializeType::Protobuf => self
.write_to_bytes()
... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
smallnest/rpcx-rs | https://github.com/smallnest/rpcx-rs/blob/09578e704de21af635da8357d36be468f10df27b/examples/client_call_mul_async/src/main.rs | examples/client_call_mul_async/src/main.rs | use std::collections::hash_map::HashMap;
use mul_model::*;
use rpcx::*;
#[tokio::main]
pub async fn main() -> Result<()> {
let mut c: Client = Client::new("127.0.0.1:8972");
c.start().map_err(|err| println!("{}", err)).unwrap();
c.opt.serialize_type = SerializeType::MsgPack;
let mut a = 1;
loop {... | rust | Apache-2.0 | 09578e704de21af635da8357d36be468f10df27b | 2026-01-04T20:19:51.398380Z | false |
luis-ota/swaptop | https://github.com/luis-ota/swaptop/blob/7b724d1125d48c737562fdb45537c6143141a685/src/swap_info.rs | src/swap_info.rs | use std::collections::HashMap;
use thiserror::Error;
#[cfg(target_os = "windows")]
use std::io;
#[cfg(target_os = "linux")]
use proc_mounts::SwapIter;
#[cfg(target_os = "linux")]
use procfs::{self, Current, Meminfo};
#[derive(Debug, Clone)]
pub struct ProcessSwapInfo {
pub pid: u32,
pub name: String,
pub... | rust | MIT | 7b724d1125d48c737562fdb45537c6143141a685 | 2026-01-04T20:19:37.018154Z | false |
luis-ota/swaptop | https://github.com/luis-ota/swaptop/blob/7b724d1125d48c737562fdb45537c6143141a685/src/theme.rs | src/theme.rs | use ratatui::style::Color;
#[derive(Debug, Clone, Copy, Default)]
pub enum ThemeType {
#[default]
Default,
Solarized,
Monokai,
Dracula,
Nord,
}
#[derive(Debug, Clone, Copy)]
pub struct Theme {
pub primary: Color,
pub secondary: Color,
pub text: Color,
pub border: Color,
pub ... | rust | MIT | 7b724d1125d48c737562fdb45537c6143141a685 | 2026-01-04T20:19:37.018154Z | false |
luis-ota/swaptop | https://github.com/luis-ota/swaptop/blob/7b724d1125d48c737562fdb45537c6143141a685/src/main.rs | src/main.rs | mod swap_info;
mod theme;
#[cfg(target_os = "linux")]
use crate::swap_info::find_mount_device;
use crate::swap_info::{SwapUpdate, aggregate_processes, convert_swap};
use crate::theme::{Theme, ThemeType};
use color_eyre::Result;
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
use ra... | rust | MIT | 7b724d1125d48c737562fdb45537c6143141a685 | 2026-01-04T20:19:37.018154Z | false |
ethicalhackingplayground/pathbuster | https://github.com/ethicalhackingplayground/pathbuster/blob/0df3d492f21ad5d0ee12043a2269c1276f34f86b/src/main.rs | src/main.rs | use std::collections::HashMap;
use std::error::Error;
use std::io::Write;
use std::process::exit;
use std::time::Duration;
use clap::App;
use clap::Arg;
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use tokio::fs::OpenOptions;
use tokio::sync::mpsc;
use tokio::io::{AsyncBufReadExt, BufReader};
use t... | rust | MIT | 0df3d492f21ad5d0ee12043a2269c1276f34f86b | 2026-01-04T20:19:52.199745Z | false |
ethicalhackingplayground/pathbuster | https://github.com/ethicalhackingplayground/pathbuster/blob/0df3d492f21ad5d0ee12043a2269c1276f34f86b/src/bruteforcer/mod.rs | src/bruteforcer/mod.rs | use std::{error::Error, process::exit, time::Duration};
use colored::Colorize;
use difference::{Changeset, Difference};
use governor::{Quota, RateLimiter};
use indicatif::ProgressBar;
use itertools::iproduct;
use reqwest::{redirect, Proxy};
use tokio::{fs::File, io::AsyncWriteExt, sync::mpsc};
use crate::utils;
// t... | rust | MIT | 0df3d492f21ad5d0ee12043a2269c1276f34f86b | 2026-01-04T20:19:52.199745Z | false |
ethicalhackingplayground/pathbuster | https://github.com/ethicalhackingplayground/pathbuster/blob/0df3d492f21ad5d0ee12043a2269c1276f34f86b/src/detector/mod.rs | src/detector/mod.rs | use std::{error::Error, process::exit, str::FromStr, time::Duration};
use colored::Colorize;
use governor::{Quota, RateLimiter};
use indicatif::ProgressBar;
use itertools::iproduct;
use regex::Regex;
use reqwest::{redirect, Proxy};
use tokio::{fs::File, io::AsyncWriteExt, sync::mpsc};
// the Job struct which will be ... | rust | MIT | 0df3d492f21ad5d0ee12043a2269c1276f34f86b | 2026-01-04T20:19:52.199745Z | true |
ethicalhackingplayground/pathbuster | https://github.com/ethicalhackingplayground/pathbuster/blob/0df3d492f21ad5d0ee12043a2269c1276f34f86b/src/utils/mod.rs | src/utils/mod.rs | use distance::sift3;
// the Threshold struct which will be used as a range
// to tell how far appart the responses are from the web root
struct Threshold {
threshold_start: f32,
threshold_end: f32,
}
// make it global :)
const CHANGE: Threshold = Threshold {
threshold_start: 500.0,
threshold_end: 50000... | rust | MIT | 0df3d492f21ad5d0ee12043a2269c1276f34f86b | 2026-01-04T20:19:52.199745Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/lib.rs | src/lib.rs | #![cfg_attr(feature = "nightly", feature(try_trait_v2))]
#![cfg_attr(feature = "doc-cfg", feature(doc_cfg))]
#![warn(clippy::pedantic, clippy::cargo, unsafe_op_in_unsafe_fn, missing_docs)]
#![allow(
clippy::missing_safety_doc,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_r... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/nethost.rs | src/nethost.rs | use crate::{
bindings::{nethost::get_hostfxr_parameters, MAX_PATH},
error::{HostingError, HostingResult, HostingSuccess},
hostfxr::Hostfxr,
pdcstring::{self, PdCStr, PdUChar},
};
use std::{ffi::OsString, mem::MaybeUninit, ptr};
use thiserror::Error;
/// Gets the path to the hostfxr library.
pub fn get_... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/utils.rs | src/utils.rs | #![cfg(unix)]
/// Utilities for configuring the alternate signal stack on Unix platforms.
///
/// Rust installs a small alternate signal stack for handling certain signals such as `SIGSEGV`.
/// When embedding or hosting the .NET CoreCLR inside Rust, this small stack may be insufficient
/// for the CLR exception-handl... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/delegate_loader.rs | src/hostfxr/delegate_loader.rs | use crate::{
bindings::{
char_t,
hostfxr::{component_entry_point_fn, load_assembly_and_get_function_pointer_fn},
},
error::{HostingError, HostingResult, HostingSuccess},
pdcstring::{PdCStr, PdCString},
};
use num_enum::TryFromPrimitive;
use std::{convert::TryFrom, mem::MaybeUninit, path:... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/managed_function.rs | src/hostfxr/managed_function.rs | use std::{fmt::Debug, ops::Deref};
pub use fn_ptr::{FnPtr, UntypedFnPtr as RawFnPtr};
/// A wrapper around a managed function pointer.
pub struct ManagedFunction<F: ManagedFnPtr>(pub(crate) F);
impl<F: ManagedFnPtr> Debug for ManagedFunction<F> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/runtime_property.rs | src/hostfxr/runtime_property.rs | use std::{collections::HashMap, mem::MaybeUninit, ptr};
use crate::{
error::{HostingError, HostingResult},
pdcstring::PdCStr,
};
use super::HostfxrContext;
impl<I> HostfxrContext<I> {
/// Gets the runtime property value for the given key of this host context.
pub fn get_runtime_property_value(
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/library2_1.rs | src/hostfxr/library2_1.rs | use crate::{
bindings::hostfxr::{
hostfxr_resolve_sdk2_flags_t, hostfxr_resolve_sdk2_result_key_t, PATH_LIST_SEPARATOR,
},
error::{HostingError, HostingResult},
hostfxr::{AppOrHostingResult, Hostfxr},
pdcstring::{PdCStr, PdUChar},
};
use coreclr_hosting_shared::char_t;
use std::{cell::RefC... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/library.rs | src/hostfxr/library.rs | use crate::{
dlopen2::wrapper::Container,
error::{HostingError, HostingResult},
pdcstring::PdCString,
};
use derive_more::From;
use std::{
env::consts::EXE_SUFFIX,
ffi::OsString,
path::{Path, PathBuf},
sync::Arc,
};
pub(crate) type HostfxrLibrary = Container<crate::bindings::hostfxr::wrappe... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/mod.rs | src/hostfxr/mod.rs | mod library;
pub use library::*;
#[cfg(feature = "netcore1_0")]
mod library1_0;
#[cfg(feature = "netcore1_0")]
#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "netcore1_0")))]
#[allow(unused)]
pub use library1_0::*;
#[cfg(feature = "netcore2_1")]
mod library2_1;
#[cfg(feature = "netcore2_1")]
#[cfg_attr(feature = "... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/library6_0.rs | src/hostfxr/library6_0.rs | use hostfxr_sys::hostfxr_dotnet_environment_info;
use crate::{
error::{HostingError, HostingResult},
hostfxr::Hostfxr,
pdcstring::{PdCStr, PdCString},
};
use std::{ffi::c_void, mem::MaybeUninit, path::PathBuf, ptr, slice};
use super::UNSUPPORTED_HOST_VERSION_ERROR_CODE;
/// Information about the current ... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/library1_0.rs | src/hostfxr/library1_0.rs | use crate::{
hostfxr::{AppOrHostingResult, Hostfxr},
pdcstring::PdCStr,
};
use super::UNSUPPORTED_HOST_VERSION_ERROR_CODE;
impl Hostfxr {
/// Run an application.
///
/// # Note
/// This function does not return until the application completes execution.
/// It will shutdown CoreCLR after t... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/library3_0.rs | src/hostfxr/library3_0.rs | use crate::{
bindings::hostfxr::{hostfxr_handle, hostfxr_initialize_parameters},
error::{HostingError, HostingResult, HostingSuccess},
hostfxr::{
Hostfxr, HostfxrContext, HostfxrHandle, InitializedForCommandLine,
InitializedForRuntimeConfig,
},
pdcstring::{PdCStr, PdChar},
};
use std... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/hostfxr/context.rs | src/hostfxr/context.rs | use crate::{
bindings::hostfxr::{
hostfxr_delegate_type, hostfxr_handle, load_assembly_and_get_function_pointer_fn,
},
error::{HostingError, HostingResult, HostingSuccess},
hostfxr::{
AppOrHostingResult, AssemblyDelegateLoader, DelegateLoader, Hostfxr, HostfxrLibrary,
RawFnPtr, S... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/error/univ.rs | src/error/univ.rs | use thiserror::Error;
/// A universal error type encompassing all possible errors from the [`netcorehost`](crate) crate.
#[derive(Debug, Error)]
pub enum Error {
/// An error from the native hosting components.
#[error(transparent)]
Hosting(#[from] crate::error::HostingError),
/// An error while loadin... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/error/mod.rs | src/error/mod.rs | mod hosting_result;
pub use hosting_result::*;
mod univ;
pub use univ::*;
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/error/hosting_result.rs | src/error/hosting_result.rs | use std::convert::TryFrom;
#[cfg(feature = "nightly")]
use std::ops::{ControlFlow, FromResidual, Try};
use crate::bindings;
use derive_more::{Deref, Display, From};
/// Result of a hosting API operation of `hostfxr`, `hostpolicy` and `nethost`.
///
/// Source: [https://github.com/dotnet/runtime/blob/main/docs/design/... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | true |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/error.rs | src/pdcstring/error.rs | use std::{
error::Error,
fmt::{self, Display},
};
use super::{MissingNulTerminatorInnerImpl, PdUChar, ToStringErrorInner, ToStringErrorInnerImpl};
// same definition as ffi::NulError and widestring::error::ContainsNul<u16>
/// An error returned to indicate that an invalid nul value was found in a string.
#[mu... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/mod.rs | src/pdcstring/mod.rs | mod error;
pub use error::*;
/// The platform-dependent character type used by the hosting components.
pub type PdChar = crate::bindings::char_t;
/// The unsigned version of the platform-dependent character type used by the hosting components.
#[cfg(windows)]
pub type PdUChar = u16;
/// The unsigned version of the pla... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/shared.rs | src/pdcstring/shared.rs | use std::{
borrow::Borrow,
convert::TryFrom,
ffi::{OsStr, OsString},
fmt::{self, Debug, Display, Formatter},
ops::Deref,
str::FromStr,
};
use super::{
ContainsNul, MissingNulTerminator, PdCStrInner, PdCStrInnerImpl, PdCStringInner,
PdCStringInnerImpl, PdChar, PdUChar, ToStringError,
};
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/mod.rs | src/pdcstring/impl/mod.rs | mod traits;
pub(crate) use traits::*;
#[cfg(windows)]
pub mod windows;
#[cfg(windows)]
pub(crate) use windows::*;
#[cfg(not(windows))]
pub mod other;
#[cfg(not(windows))]
pub(crate) use other::*;
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/traits.rs | src/pdcstring/impl/traits.rs | use std::{
error::Error,
ffi::{OsStr, OsString},
fmt::{Debug, Display},
};
use crate::pdcstring::{ContainsNul, MissingNulTerminator, PdChar, PdUChar, ToStringError};
pub(crate) trait PdCStringInner
where
Self: Sized,
{
fn from_str(s: impl AsRef<str>) -> Result<Self, ContainsNul>;
fn from_os_st... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/windows/pdcstring.rs | src/pdcstring/impl/windows/pdcstring.rs | use widestring::U16CString;
use crate::pdcstring::{ContainsNul, PdCStringInner, PdChar};
impl PdCStringInner for U16CString {
fn from_str(s: impl AsRef<str>) -> Result<Self, ContainsNul> {
Ok(U16CString::from_str(s)?)
}
fn from_os_str(s: impl AsRef<std::ffi::OsStr>) -> Result<Self, ContainsNul> {... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/windows/ext.rs | src/pdcstring/impl/windows/ext.rs | use widestring::{U16CStr, U16CString};
use crate::pdcstring::{PdCStr, PdCString};
pub trait PdCStringExt
where
Self: Sized,
{
fn from_u16_c_string(s: U16CString) -> Self;
fn into_u16_c_string(self) -> U16CString;
}
impl PdCStringExt for PdCString {
fn from_u16_c_string(s: U16CString) -> Self {
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/windows/error.rs | src/pdcstring/impl/windows/error.rs | use crate::pdcstring::{MissingNulTerminatorInner, ToStringErrorInner};
impl ToStringErrorInner for widestring::error::Utf16Error {
fn index(&self) -> Option<usize> {
Some(self.index())
}
}
impl MissingNulTerminatorInner for widestring::error::MissingNulTerminator {}
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/windows/pdcstr.rs | src/pdcstring/impl/windows/pdcstr.rs | use std::ffi::OsString;
use widestring::U16CStr;
use crate::pdcstring::{MissingNulTerminator, PdCStrInner, PdChar, ToStringError};
#[doc(hidden)]
pub extern crate widestring;
#[macro_export]
/// A macro for creating a [`PdCStr`](crate::pdcstring::PdCStr) at compile time.
macro_rules! pdcstr {
($expression:expr)... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/windows/mod.rs | src/pdcstring/impl/windows/mod.rs | pub(crate) type PdCStringInnerImpl = widestring::U16CString;
pub(crate) type PdCStrInnerImpl = widestring::U16CStr;
pub(crate) type ToStringErrorInnerImpl = widestring::error::Utf16Error;
pub(crate) type MissingNulTerminatorInnerImpl = widestring::error::MissingNulTerminator;
mod pdcstr;
pub use pdcstr::*;
mod pdcstr... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/other/pdcstring.rs | src/pdcstring/impl/other/pdcstring.rs | use std::{
ffi::{CStr, CString},
os::unix::prelude::OsStrExt,
};
use crate::pdcstring::{ContainsNul, PdCStringInner, PdChar, PdUChar};
impl PdCStringInner for CString {
fn from_str(s: impl AsRef<str>) -> Result<Self, ContainsNul> {
Self::from_vec(s.as_ref().as_bytes().to_vec())
}
fn from_... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/other/ext.rs | src/pdcstring/impl/other/ext.rs | use std::ffi::{CStr, CString};
use crate::pdcstring::{PdCStr, PdCString};
pub trait PdCStringExt
where
Self: Sized,
{
fn from_c_string(s: CString) -> Self;
fn into_c_string(self) -> CString;
}
impl PdCStringExt for PdCString {
fn from_c_string(s: CString) -> Self {
Self::from_inner(s)
}
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/other/error.rs | src/pdcstring/impl/other/error.rs | use crate::pdcstring::{MissingNulTerminatorInner, ToStringErrorInner};
impl ToStringErrorInner for std::str::Utf8Error {
fn index(&self) -> Option<usize> {
self.error_len()
}
}
impl MissingNulTerminatorInner for std::ffi::FromBytesWithNulError {}
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/other/pdcstr.rs | src/pdcstring/impl/other/pdcstr.rs | use std::{
ffi::{CStr, OsStr, OsString},
os::unix::prelude::OsStrExt,
};
use crate::pdcstring::{MissingNulTerminator, PdCStrInner, PdChar, PdUChar, ToStringError};
#[doc(hidden)]
pub extern crate cstr;
#[macro_export]
/// A macro for creating a [`PdCStr`](crate::pdcstring::PdCStr) at compile time.
macro_rule... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/pdcstring/impl/other/mod.rs | src/pdcstring/impl/other/mod.rs | pub(crate) type PdCStringInnerImpl = std::ffi::CString;
pub(crate) type PdCStrInnerImpl = std::ffi::CStr;
pub(crate) type ToStringErrorInnerImpl = std::str::Utf8Error;
pub(crate) type MissingNulTerminatorInnerImpl = std::ffi::FromBytesWithNulError;
mod pdcstr;
pub use pdcstr::*;
mod pdcstring;
#[allow(unused)]
pub us... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/src/bindings/mod.rs | src/bindings/mod.rs | extern crate coreclr_hosting_shared;
/// Module for shared bindings for all hosting components.
pub use coreclr_hosting_shared::*;
/// Module containing the raw bindings for hostfxr.
pub use hostfxr_sys as hostfxr;
/// Module containing the raw bindings for nethost.
#[cfg(feature = "nethost")]
pub use nethost_sys as... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/errors.rs | tests/errors.rs | #![cfg(feature = "netcore3_0")]
use netcorehost::{hostfxr::GetManagedFunctionError, nethost, pdcstr};
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
fn get_function_pointer() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/manual_close_frees_lib.rs | tests/manual_close_frees_lib.rs | #![cfg(feature = "netcore3_0")]
use std::sync::Arc;
use netcorehost::nethost;
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
fn manual_close_frees_lib() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = ho... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/custom_delegate_type.rs | tests/custom_delegate_type.rs | #![cfg(feature = "netcore3_0")]
use netcorehost::{nethost, pdcstr};
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
fn unmanaged_caller_hello_world() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/run_app.rs | tests/run_app.rs | #![allow(deprecated)]
use netcorehost::nethost;
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
#[cfg(feature = "netcore3_0")]
fn run_app_with_context() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = ... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/hello_world.rs | tests/hello_world.rs | #![cfg(feature = "netcore3_0")]
use netcorehost::{nethost, pdcstr};
use rusty_fork::rusty_fork_test;
use std::ptr;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
fn hello_world() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/unhandled_managed_exeptions.rs | tests/unhandled_managed_exeptions.rs | #![cfg(all(feature = "netcore3_0", feature = "utils", unix))]
// see https://github.com/OpenByteDev/netcorehost/issues/38
#[path = "common.rs"]
mod common;
use netcorehost::{
nethost, pdcstr,
utils::altstack::{self, State},
};
use rusty_fork::{fork, rusty_fork_id, ChildWrapper, ExitStatusWrapper};
use std::{i... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/environment_info.rs | tests/environment_info.rs | #![cfg(feature = "net6_0")]
use netcorehost::{
hostfxr::{EnvironmentInfo, FrameworkInfo, SdkInfo},
nethost,
};
use std::{
collections::HashMap,
path::{Path, PathBuf},
process::Command,
str::FromStr,
};
#[path = "common.rs"]
mod common;
#[test]
fn get_dotnet_environment_info() {
use netcor... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/runtime_properties.rs | tests/runtime_properties.rs | #![cfg(feature = "netcore3_0")]
use netcorehost::{nethost, pdcstr};
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
fn runtime_properties() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let mut context = hostfxr
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/pdcstr.rs | tests/pdcstr.rs | use std::{fs, process::Command};
#[test]
fn try_build() {
// as different macros are used depending on the os -> copy the correct contents to the .stderr fil.
let family = if cfg!(windows) { "windows" } else { "other" };
fs::copy(
format!(
"tests/macro-build-tests/pdcstr-compile-fail.{}... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/load_assembly_manually.rs | tests/load_assembly_manually.rs | #![cfg(feature = "net8_0")]
use netcorehost::{nethost, pdcstr};
use rusty_fork::rusty_fork_test;
use std::fs;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
fn load_from_path() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/error_writer.rs | tests/error_writer.rs | #![allow(deprecated)]
use netcorehost::{hostfxr::Hostfxr, nethost, pdcstr};
use rusty_fork::rusty_fork_test;
use std::cell::Cell;
#[path = "common.rs"]
mod common;
fn cause_error(hostfxr: &Hostfxr) {
let bad_path = pdcstr!("bad.runtimeconfig.json");
let _ = hostfxr.initialize_for_runtime_config(bad_path);
}
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/primary_and_secondary.rs | tests/primary_and_secondary.rs | #![cfg(feature = "netcore3_0")]
use netcorehost::nethost;
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
#[test]
fn primary_is_primary() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr
.initia... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/common.rs | tests/common.rs | #![allow(unused)]
use netcorehost::pdcstring::PdCString;
use path_absolutize::Absolutize;
use std::{
env,
path::{Path, PathBuf},
process::Command,
str::FromStr,
};
pub fn test_netcore_version() -> String {
env::var("NETCOREHOST_TEST_NETCORE_VERSION").unwrap_or_else(|_| "net10.0".to_string())
}
pu... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/unmanaged_callers_only.rs | tests/unmanaged_callers_only.rs | #![cfg(feature = "netcore3_0")]
use netcorehost::{nethost, pdcstr};
use rusty_fork::rusty_fork_test;
#[path = "common.rs"]
mod common;
rusty_fork_test! {
fn unmanaged_caller_hello_world() {
common::setup();
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr
... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/sdk_resolve.rs | tests/sdk_resolve.rs | use netcorehost::{nethost, pdcstr, pdcstring::PdCString};
use std::{
path::{Path, PathBuf},
process::Command,
};
#[path = "common.rs"]
mod common;
#[test]
#[cfg(feature = "netcore3_0")]
fn resolve_sdk() {
let hostfxr = nethost::load_hostfxr().unwrap();
let actual_sdks = get_sdks();
let sdks_dir =... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/macro-build-tests/pdcstr-compile-fail.rs | tests/macro-build-tests/pdcstr-compile-fail.rs | fn main() {
// with internal nul
let _ = netcorehost::pdcstr!("\0");
let _ = netcorehost::pdcstr!("somerandomteststring\0");
let _ = netcorehost::pdcstr!("somerandomteststring\0somerandomteststring");
}
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/macro-build-tests/pdcstr-pass.rs | tests/macro-build-tests/pdcstr-pass.rs | fn main() {
let _ = netcorehost::pdcstr!("");
let _ = netcorehost::pdcstr!("test");
let _ = netcorehost::pdcstr!("test with spaces");
let _ = netcorehost::pdcstr!("0");
let _ = netcorehost::pdcstr!("\\0");
let _ = netcorehost::pdcstr!("κόσμε");
}
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/tests/macro-test-crate/src/main.rs | tests/macro-test-crate/src/main.rs | fn main() {
let _ = netcorehost::pdcstr!("test");
}
| rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/examples/run-app/main.rs | examples/run-app/main.rs | use netcorehost::{nethost, pdcstr};
fn main() {
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr
.initialize_for_dotnet_command_line(pdcstr!(
"examples/run-app/ExampleProject/bin/Debug/net10.0/ExampleProject.dll"
))
.unwrap();
context.run_app().as_ho... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/examples/call-managed-function/main.rs | examples/call-managed-function/main.rs | use netcorehost::{nethost, pdcstr};
fn main() {
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr.initialize_for_runtime_config(pdcstr!("examples/call-managed-function/ExampleProject/bin/Debug/net10.0/ExampleProject.runtimeconfig.json")).unwrap();
let delegate_loader = context
.... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/examples/return-string-from-managed/main.rs | examples/return-string-from-managed/main.rs | #![warn(unsafe_op_in_unsafe_fn)]
// See also call-native-function example
use core::slice;
use std::{
ffi::{CStr, CString},
mem::{self, MaybeUninit},
os::raw::c_char,
str::Utf8Error,
string::FromUtf16Error,
};
use netcorehost::{
hostfxr::{AssemblyDelegateLoader, ManagedFunction},
nethost, ... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/examples/call-native-function/main.rs | examples/call-native-function/main.rs | // Note that this example requires the unstable rustc flag "-Z export-executable-symbols"
use netcorehost::{nethost, pdcstr};
#[no_mangle]
pub extern "system" fn rusty_increment(n: i32) -> i32 {
println!("Called rusty increment with {n}");
n + 1
}
fn main() {
let hostfxr = nethost::load_hostfxr().unwrap(... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/examples/run-app-with-args/main.rs | examples/run-app-with-args/main.rs | use std::env;
use netcorehost::{nethost, pdcstr, pdcstring::PdCString};
fn main() {
let hostfxr = nethost::load_hostfxr().unwrap();
let args = env::args()
.skip(1) // skip rust host program name
.map(|arg| PdCString::from_os_str(arg).unwrap());
let context = hostfxr
.initialize_f... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
OpenByteDev/netcorehost | https://github.com/OpenByteDev/netcorehost/blob/4742a5d235b279a35b235bf7726c5afb9bde521d/examples/passing-parameters/main.rs | examples/passing-parameters/main.rs | use netcorehost::{hostfxr::AssemblyDelegateLoader, nethost, pdcstr};
fn main() {
let hostfxr = nethost::load_hostfxr().unwrap();
let context = hostfxr.initialize_for_runtime_config(pdcstr!("examples/passing-parameters/ExampleProject/bin/Debug/net10.0/ExampleProject.runtimeconfig.json")).unwrap();
let deleg... | rust | MIT | 4742a5d235b279a35b235bf7726c5afb9bde521d | 2026-01-04T20:18:20.341772Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/src/lib.rs | prae/src/lib.rs | #![cfg_attr(docsrs, feature(doc_cfg))]
//! `prae` is a crate that aims to provide a better way to define types that
//! require validation.
//!
//! The main concept of the library is the [`Wrapper`](crate::Wrapper) trait.
//! This trait describes a
//! [`Newtype`](https://rust-unofficial.github.io/patterns/patterns/be... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/src/core.rs | prae/src/core.rs | use std::error::Error;
use std::fmt;
/// A trait that describes a
/// [`Newtype`](https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html)
/// wrapper struct generated by [`define!`](crate::define) and
/// [`extend!`](crate::extend) macros.
pub trait Wrapper: Sized {
/// Name of the wrapper. W... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/src/plugins.rs | prae/src/plugins.rs | mod serde;
mod std;
| rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/src/plugins/serde.rs | prae/src/plugins/serde.rs | /// Implement [`serde::Serialize`](::serde::Serialize) and
/// [`serde::Deserialize`](::serde::Deserialize) for the wrapper. Deserilization
/// will fail if the value doesn't pass wrapper's
/// [`PROCESS`](crate::Wrapper::PROCESS) function.
///
/// For this to work, the inner type of the wrapper must also implement the... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/src/plugins/std.rs | prae/src/plugins/std.rs | /// Implement [`Deref`](::core::ops::Deref) for the wrapper.
#[macro_export]
macro_rules! impl_deref {
($wrapper:ident) => {
impl ::core::ops::Deref for $wrapper {
type Target = <$wrapper as $crate::Wrapper>::Inner;
fn deref(&self) -> &Self::Target {
&self.0
... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/impl_serde.rs | prae/tests/impl_serde.rs | #[cfg(feature = "serde")]
mod tests {
use prae::Wrapper;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
struct User {
name: Username,
}
prae::define! {
#[derive(Debug)]
Username: String;
adjust |u| *u = u.trim().to_owned();
... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/impl_index.rs | prae/tests/impl_index.rs | use prae::Wrapper;
prae::define! {
#[derive(Debug)]
Numbers: Vec<u64>;
plugins: [
prae::impl_index,
];
}
#[test]
fn index_works() {
let nums = Numbers::new([1, 2, 3]).unwrap();
assert_eq!(nums[1], 2);
}
| rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/ensure.rs | prae/tests/ensure.rs | use assert_matches::assert_matches;
use prae::Wrapper;
prae::define! {
#[derive(Debug)]
pub Username: String;
ensure |u| !u.is_empty();
}
#[test]
fn construction_error_formats_correctly() {
let err = Username::new("").unwrap_err();
assert_eq!(
err.to_string(),
"failed to construct ... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/adjust_ensure.rs | prae/tests/adjust_ensure.rs | use assert_matches::assert_matches;
use prae::Wrapper;
prae::define! {
#[derive(Debug)]
pub Username: String;
adjust |u| *u = u.trim().to_owned();
ensure |u| !u.is_empty();
}
#[test]
fn construction_fails_for_invalid_data() {
assert_matches!(Username::new(" "), Err(prae::ConstructionError { .. })... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/extend.rs | prae/tests/extend.rs | use prae::Wrapper;
prae::define! {
#[derive(Debug)]
Text: String;
adjust |t| *t = t.trim().to_owned();
validate(&'static str) |t| {
if t.is_empty() {
Err("provided text is empty")
} else {
Ok(())
}
};
}
prae::extend! {
#[derive(Debug)]
CapTex... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/non_clone.rs | prae/tests/non_clone.rs | struct User {
name: String,
}
prae::define! {
ValidUser: User;
ensure |u| !u.name.is_empty();
}
| rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/impl_display.rs | prae/tests/impl_display.rs | use prae::Wrapper;
prae::define! {
#[derive(Debug)]
Username: String;
plugins: [
prae::impl_display,
];
}
#[test]
fn display_works() {
let un = Username::new("lala").unwrap();
assert_eq!(format!("{}", un), "lala");
}
| rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/impl_deref.rs | prae/tests/impl_deref.rs | use prae::Wrapper;
prae::define! {
#[derive(Clone, Debug)]
ImplementsClone: String;
plugins: [
prae::impl_deref,
];
}
prae::define! {
#[derive(Debug)]
NotImplementsClone: String;
plugins: [
prae::impl_deref,
];
}
#[test]
#[allow(clippy::redundant_clone)]
fn deref_works... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/unprocessed.rs | prae/tests/unprocessed.rs | #[cfg(feature = "unprocessed")]
mod tests {
use prae::Wrapper;
prae::define! {
pub Username: String;
ensure |u| !u.is_empty();
}
#[test]
fn unprocessed_construction_never_fails() {
let u = Username::new_unprocessed("lala");
assert_eq!(u.get(), "lala");
let u... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
teenjuna/prae | https://github.com/teenjuna/prae/blob/bd2bfd476108ebcfcb91c2710fdf92eb123a169d/prae/tests/adjust_validate.rs | prae/tests/adjust_validate.rs | use assert_matches::assert_matches;
use prae::Wrapper;
#[derive(Debug)]
pub struct UsernameError;
prae::define! {
#[derive(Debug)]
pub Username: String;
adjust |u| *u = u.trim().to_owned();
validate(UsernameError) |u| {
if u.is_empty() {
Err(UsernameError)
} else {
... | rust | Unlicense | bd2bfd476108ebcfcb91c2710fdf92eb123a169d | 2026-01-04T20:20:00.811147Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.