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 |
|---|---|---|---|---|---|---|---|---|
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc4315.rs | imap-proto/src/parser/rfc4315.rs | //!
//! https://tools.ietf.org/html/rfc4315
//!
//! The IMAP UIDPLUS Extension
//!
use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case},
combinator::map,
multi::separated_list1,
sequence::{preceded, tuple},
IResult,
};
use crate::parser::core::number;
use crate::types::*;
/// Extends ... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc4314.rs | imap-proto/src/parser/rfc4314.rs | //!
//! Current
//! https://tools.ietf.org/html/rfc4314
//!
//! Original
//! https://tools.ietf.org/html/rfc2086
//!
//! The IMAP ACL Extension
//!
use std::borrow::Cow;
use nom::{
bytes::streaming::tag_no_case,
character::complete::{space0, space1},
combinator::map,
multi::separated_list0,
sequen... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc5161.rs | imap-proto/src/parser/rfc5161.rs | //!
//! https://tools.ietf.org/html/rfc5161
//!
//! The IMAP ENABLE Extension
//!
use nom::{
bytes::streaming::tag_no_case,
character::streaming::char,
combinator::map,
multi::many0,
sequence::{preceded, tuple},
IResult,
};
use std::borrow::Cow;
use crate::parser::core::atom;
use crate::types:... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc2087.rs | imap-proto/src/parser/rfc2087.rs | //!
//! https://tools.ietf.org/html/rfc2087
//!
//! IMAP4 QUOTA extension
//!
use std::borrow::Cow;
use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case},
character::streaming::space1,
combinator::map,
multi::many0,
multi::separated_list0,
sequence::{delimited, preceded, tuple},
... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/bodystructure.rs | imap-proto/src/parser/bodystructure.rs | use std::collections::HashMap;
use crate::types::BodyStructure;
/// An utility parser helping to find the appropriate
/// section part from a FETCH response.
pub struct BodyStructParser<'a> {
root: &'a BodyStructure<'a>,
prefix: Vec<u32>,
iter: u32,
map: HashMap<Vec<u32>, &'a BodyStructure<'a>>,
}
imp... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc3501/body_structure.rs | imap-proto/src/parser/rfc3501/body_structure.rs | use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case},
character::streaming::char,
combinator::{map, opt},
multi::many1,
sequence::{delimited, preceded, tuple},
IResult,
};
use std::borrow::Cow;
use crate::{
parser::{core::*, rfc3501::envelope},
types::*,
};
// body-fields ... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc3501/mod.rs | imap-proto/src/parser/rfc3501/mod.rs | //!
//! https://tools.ietf.org/html/rfc3501
//!
//! INTERNET MESSAGE ACCESS PROTOCOL
//!
use std::borrow::Cow;
use std::str::from_utf8;
use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case, take_while, take_while1},
character::streaming::char,
combinator::{map, map_res, opt, recognize, value},
... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/src/parser/rfc3501/body.rs | imap-proto/src/parser/rfc3501/body.rs | use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case},
character::streaming::char,
combinator::{map, opt},
multi::many0,
sequence::{delimited, preceded, tuple},
IResult,
};
use std::borrow::Cow;
use crate::{parser::core::*, types::*};
pub fn section_part(i: &[u8]) -> IResult<&[u8], ... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/fuzz/fuzz_targets/utf8_parse_response.rs | imap-proto/fuzz/fuzz_targets/utf8_parse_response.rs | #![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate imap_proto;
// UTF-8
fuzz_target!(|data: &[u8]| {
let _ = imap_proto::Response::from_bytes(data);
});
| rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/imap-proto/examples/parse_response.rs | imap-proto/examples/parse_response.rs | use imap_proto::Response;
use std::io::Write;
fn main() -> std::io::Result<()> {
loop {
let line = {
print!("Enter IMAP4REV1 response: ");
std::io::stdout().flush().unwrap();
let mut line = String::new();
std::io::stdin().read_line(&mut line)?;
l... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/tokio-imap/src/lib.rs | tokio-imap/src/lib.rs | mod client;
mod codec;
pub use crate::client::{Client, TlsClient};
pub use crate::codec::ResponseData;
pub mod builders {
pub use imap_proto::builders::command::{fetch, CommandBuilder, FetchCommand};
}
pub mod types {
pub use imap_proto::types::*;
}
| rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/tokio-imap/src/codec.rs | tokio-imap/src/codec.rs | use std::io;
use std::mem;
use bytes::{BufMut, Bytes, BytesMut};
use nom::{self, Needed};
use tokio_util::codec::{Decoder, Encoder};
use imap_proto::types::{Request, RequestId, Response};
#[derive(Default)]
pub struct ImapCodec {
decode_need_message_bytes: usize,
}
impl Decoder for ImapCodec {
type Item = R... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/tokio-imap/src/client.rs | tokio-imap/src/client.rs | use std::borrow::Cow;
use std::io;
use std::net::ToSocketAddrs;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{ready, Context, Poll};
use futures_sink::Sink;
use futures_util::{Stream, StreamExt};
use pin_project_lite::pin_project;
use rustls_pki_types::ServerName;
use tokio::io::{AsyncRead, AsyncWrite};
use t... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
djc/tokio-imap | https://github.com/djc/tokio-imap/blob/82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c/tokio-imap/examples/basic.rs | tokio-imap/examples/basic.rs | use std::error::Error;
use std::fmt::{self, Display, Formatter};
use std::io;
use futures_util::stream::TryStreamExt;
use tokio_imap::builders::CommandBuilder;
use tokio_imap::types::{Attribute, AttributeValue, Response};
use tokio_imap::ResponseData;
use tokio_imap::TlsClient;
#[tokio::main]
async fn main() {
le... | rust | Apache-2.0 | 82c6967ad529e5f9cfa6b0c59aecb2f0b5f6bd8c | 2026-01-04T20:22:37.594708Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/config.rs | src/config.rs | use crate::test::{self, SecretValue};
use chrono::Local;
use log::error;
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, env, path::Path};
#[derive(PartialEq, Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Config {
pub settings: Settings,
pub globals:... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/errors.rs | src/errors.rs | use std::fmt;
#[derive(Debug, Clone)]
pub struct ValidationError {
pub reason: String,
}
impl std::error::Error for ValidationError {}
impl fmt::Display for ValidationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.reason.is_empty() {
write!(f, "test validation")
... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test.rs | src/test.rs | pub mod definition;
pub mod file;
pub mod http;
pub mod template;
pub mod validation;
pub mod variable;
use crate::test::file::BodyOrSchema;
use self::file::{generate_value_from_schema, UnvalidatedRequest, UnvalidatedResponse};
use crate::test::{
definition::RequestBody,
file::{
DatumSchema, FloatSpeci... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | true |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/logger.rs | src/logger.rs | use log::{Level, Log, Metadata, Record};
use std::{
io::{self, Write},
sync::Mutex,
};
pub struct SimpleLogger {
pub level: Level,
pub disabled: bool,
pub buffered: bool,
queue: Mutex<Vec<(Level, String)>>,
}
impl SimpleLogger {
pub fn new(level: Level, disabled: bool, buffered: bool) -> S... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/telemetry.rs | src/telemetry.rs | use crate::{
config,
errors::TelemetryError,
executor,
executor::ResultDetails,
machine, test,
test::{definition::RequestDescriptor, http::Header, Definition},
};
use bytes::{Bytes, BytesMut};
use http_body_util::{BodyExt, Full};
use hyper::{header::HeaderValue, Request};
use hyper_rustls::{Http... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/validated.rs | src/validated.rs | use nonempty_collections::NEVec;
use validated::{
Validated,
Validated::{Fail, Good},
};
pub trait ValidatedExt<T, E> {
fn map5<U, V, W, X, Z, F>(
self,
vu: Validated<U, E>,
vv: Validated<V, E>,
vw: Validated<W, E>,
vx: Validated<X, E>,
f: F,
) -> Validat... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/json.rs | src/json.rs | pub mod extractor;
pub mod filter;
| rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/executor.rs | src/executor.rs | use crate::{
config,
json::extractor::extract_json,
telemetry, test,
test::{
definition,
definition::ResponseDescriptor,
file::{
BodyOrSchema, BodyOrSchemaChecker, Checker, NumericSpecification,
ValueOrNumericSpecification,
},
http,
... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | true |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/main.rs | src/main.rs | mod config;
mod errors;
mod executor;
mod json;
mod logger;
mod machine;
mod new;
mod telemetry;
mod test;
mod updater;
mod validated;
use clap::{Parser, Subcommand};
use glob::{glob_with, MatchOptions};
use log::{debug, error, info, warn, Level, LevelFilter};
use logger::SimpleLogger;
use serde::{Deserialize, Seriali... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/machine.rs | src/machine.rs | use log::trace;
use sha2::{Digest, Sha256};
use sysinfo::{CpuExt, CpuRefreshKind, System, SystemExt};
pub fn new() -> Machine {
let mut system = System::new();
system.refresh_cpu_specifics(
CpuRefreshKind::everything()
.without_frequency()
.without_cpu_usage(),
);
Machi... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/updater.rs | src/updater.rs | use bytes::{Bytes, BytesMut};
use http_body_util::{BodyExt, Empty};
use hyper::Request;
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
use log::{debug, error, info, warn};
use regex::Regex;
use remove_dir_all::remove_dir_all;
use serde::Deserialize;
use std::{
cmp::Ordering,
env,
error::Error,... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/new.rs | src/new.rs | use super::{errors::GenericError, test::template};
use log::{error, info};
use crate::test::{
file::{NumericSpecification, ValueOrNumericSpecification},
http, File,
};
use std::{error::Error, io::Write};
use tokio::{fs, io::AsyncWriteExt};
fn create_tags(tags: &[String]) -> Option<String> {
if tags.is_emp... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | true |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test/variable.rs | src/test/variable.rs | use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::hash::Hash;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Modifier {
pub operation: String,
pub value: Value,
pub unit: String,
}
impl Hash for Modifier {
fn hash<H: std::hash::Hasher>(&self, state: &mut H... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test/http.rs | src/test/http.rs | use serde::{Deserialize, Serialize, Serializer};
use std::{
cell::Cell,
fmt,
hash::{Hash, Hasher},
};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct Header {
pub header: String,
pub value: String,
#[serde(skip_serializing, skip_deseriali... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test/validation.rs | src/test/validation.rs | use crate::{
test,
test::{definition, validation, variable},
};
use log::warn;
use regex::Regex;
use std::{fmt, path::PathBuf};
use ulid::Ulid;
#[derive(Debug, Clone)]
pub struct Error {
pub reason: String,
}
impl std::error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt:... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test/template.rs | src/test/template.rs | use crate::{
test,
test::{definition, file, http},
};
use std::{cell::Cell, error::Error};
use ulid::Ulid;
use super::{file::SimpleValueVariable, File};
pub fn template() -> Result<test::File, Box<dyn Error + Send + Sync>> {
Ok(test::File::default())
}
pub fn template_staged() -> Result<test::File, Box<d... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test/file.rs | src/test/file.rs | use crate::{
json::filter::filter_json,
test,
test::{definition, file::Validated::Good, http, variable, variable::Modifier},
validated::ValidatedExt,
};
use chrono::{
DateTime, Datelike, Days, Duration, Local, Months, NaiveDate, NaiveDateTime, ParseError,
TimeZone,
};
use log::{debug, error, tra... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | true |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/test/definition.rs | src/test/definition.rs | use crate::{
test,
test::{
file,
file::{NumericSpecification, ValueOrNumericSpecification},
http, validation,
},
};
use log::trace;
use serde::{Deserialize, Serialize};
use std::{cell::Cell, collections::HashSet};
use super::file::BodyOrSchema;
use crate::test::Variable;
#[derive(D... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/json/extractor.rs | src/json/extractor.rs | use serde_json::{json, Map, Value};
use std::error::Error;
pub fn extract_json(
path: &str,
depth: usize,
json: serde_json::Value,
) -> Result<serde_json::Value, Box<dyn Error + Send + Sync>> {
let path_segments: Vec<&str> = path.split('.').collect();
// println!("path ({}), depth({}), json({})", ... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/json/filter.rs | src/json/filter.rs | use serde_json::{json, Map, Value};
use std::error::Error;
pub fn filter_json(
path: &str,
depth: usize,
json: serde_json::Value,
) -> Result<serde_json::Value, Box<dyn Error + Send + Sync>> {
let path_segments: Vec<&str> = path.split('.').collect();
if depth + 1 > path_segments.len() {
ret... | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
jikkenio/jikken | https://github.com/jikkenio/jikken/blob/1849e4e0f36a7d7f90c4ce21503a035e75a72ada/src/executor/report.rs | src/executor/report.rs | pub struct Report {
run: u16,
passed: u16,
failed: u16,
} | rust | MIT | 1849e4e0f36a7d7f90c4ce21503a035e75a72ada | 2026-01-04T20:22:41.466161Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde.rs | crates/core-macros/src/serde.rs | //! Methods and types for (de)serialization.
pub mod as_str_as_ref_str;
pub mod debug_as_ref_str;
pub mod deserialize_from_cow_str;
pub mod display_as_ref_str;
pub mod enum_as_ref_str;
pub mod enum_from_string;
pub mod eq_as_ref_str;
pub mod ord_as_ref_str;
pub mod serialize_as_ref_str;
mod util;
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/lib.rs | crates/core-macros/src/lib.rs | #![doc(html_favicon_url = "https://ruma.dev/favicon.ico")]
#![doc(html_logo_url = "https://ruma.dev/images/logo.png")]
//! Procedural macros used by ruma crates.
//!
//! See the documentation for the individual macros for usage details.
// #![cfg_attr(feature = "__internal_macro_expand", feature(proc_macro_expand))]
#... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/identifiers.rs | crates/core-macros/src/identifiers.rs | //! Methods and types for generating identifiers.
pub(crate) mod constructor;
pub(crate) mod id_dst;
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/util.rs | crates/core-macros/src/util.rs | use proc_macro_crate::{FoundCrate, crate_name};
use proc_macro2::TokenStream;
use quote::{ToTokens, format_ident, quote};
use syn::{
Attribute, Field, Ident, LitStr, meta::ParseNestedMeta, punctuated::Punctuated, visit::Visit,
};
pub(crate) struct NameSpace;
impl NameSpace {
pub(crate) fn palpo_core() -> Token... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events.rs | crates/core-macros/src/events.rs | //! Methods and types for generating events.
pub mod common;
pub mod event;
pub mod event_content;
pub mod event_enum;
pub mod event_enum_from_event;
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/identifiers/id_dst.rs | crates/core-macros/src/identifiers/id_dst.rs | //! Implementation of the `IdDst` derive macro.
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::parse_quote;
use crate::util::NameSpace;
mod parse;
/// Generate the `Owned` version of an identifier and various trait implementations.
pub(crate) fn expand_id_dst(input: syn::ItemStruct) -> syn::Result... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/identifiers/constructor.rs | crates/core-macros/src/identifiers/constructor.rs | use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::parse::{Parse, ParseStream};
/// A parsed identifier constructor input.
///
/// This validates the identifier at compile time and constructs it at runtime.
///
/// This is meant to be used in a `macro_rules!` macro like this:
///
/// ```
/// macro_rules!... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/identifiers/id_dst/parse.rs | crates/core-macros/src/identifiers/id_dst/parse.rs | //! Implementations and types to parse the `IdDst` macro input.
use as_variant::as_variant;
use proc_macro2::Span;
use quote::{format_ident, quote};
use syn::{meta::ParseNestedMeta, parse_quote};
use super::IdDst;
use crate::util::NameSpace;
impl IdDst {
/// Parse the given `IdDst` macro input.
pub(super) fn... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/ord_as_ref_str.rs | crates/core-macros/src/serde/ord_as_ref_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
/// Generate the `std::cmp::Ord` and `std::cmp::PartialOrd` implementations for the type with the
/// given ident, using its `AsRef<str>` implementation.
pub fn expand_ord_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> {
Ok(quote! {
#[automati... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/eq_as_ref_str.rs | crates/core-macros/src/serde/eq_as_ref_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
/// Generate the `std::cmp::PartialEq` and `std::cmp::Eq` implementations for the type with the
/// given ident, using its `AsRef<str>` implementation.
pub fn expand_eq_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> {
Ok(quote! {
#[automatical... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/display_as_ref_str.rs | crates/core-macros/src/serde/display_as_ref_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
/// Generate the `std::fmt::Display` implementation for the type with the given ident, using its
/// `AsRef<str>` implementation.
pub fn expand_display_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> {
Ok(quote! {
#[automatically_derived]
... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/util.rs | crates/core-macros/src/serde/util.rs | use proc_macro2::TokenStream;
use quote::quote;
mod parse;
/// Parsed `palpo_enum` attributes on a container.
#[derive(Default)]
pub(super) struct PalpoEnumAttrs {
/// The global renaming rule for the variants.
pub(super) rename_all: RenameAll,
}
/// A parsed unit variant of an enum with `palpo_enum` attribu... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/enum_as_ref_str.rs | crates/core-macros/src/serde/enum_as_ref_str.rs | use proc_macro2::TokenStream;
use quote::quote;
use super::util::{RenameAll, PalpoEnumAttrs, UnitVariant, VariantWithSingleField};
/// Generate the `AsRef<str>` implementation for the given enum.
pub fn expand_enum_as_ref_str(input: &syn::ItemEnum) -> syn::Result<TokenStream> {
let palpo_enum = PalpoEnumWithAnyVa... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/deserialize_from_cow_str.rs | crates/core-macros/src/serde/deserialize_from_cow_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
use crate::util::NameSpace;
/// Generate the `serde::de:Deserialize` implementation for the type with the given ident, using its
/// `From<Cow<'a, str>>` implementation.
pub fn expand_deserialize_from_cow_str(ident: &Ident) -> syn::Result<TokenStream> {
let... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/serialize_as_ref_str.rs | crates/core-macros/src/serde/serialize_as_ref_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
use crate::util::NameSpace;
/// Generate the `serde::ser::Serialize` implementation for the type with the given ident, using its
/// `AsRef<str>` implementation.
pub fn expand_serialize_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> {
let palpo_core ... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/as_str_as_ref_str.rs | crates/core-macros/src/serde/as_str_as_ref_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
/// Generate a `pub fn as_str(&self) -> &str` method for the type with the given ident, using its
/// `AsRef<str>` implementation.
pub fn expand_as_str_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> {
let as_str_doc = format!("Creates a string slice f... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/enum_from_string.rs | crates/core-macros/src/serde/enum_from_string.rs | use proc_macro2::{Span, TokenStream};
use quote::quote;
use super::util::{RenameAll, PalpoEnumAttrs, UnitVariant, VariantWithSingleField};
/// Generate the `From<T> where T: AsRef<str> + Into<Box<str>>` implementation for the given enum.
pub fn expand_enum_from_string(input: &syn::ItemEnum) -> syn::Result<TokenStream... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/debug_as_ref_str.rs | crates/core-macros/src/serde/debug_as_ref_str.rs | use proc_macro2::{Ident, TokenStream};
use quote::quote;
/// Generate the `std::fmt::Debug` implementation for the type with the given ident, using its
/// `AsRef<str>` implementation.
pub fn expand_debug_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> {
Ok(quote! {
#[automatically_derived]
i... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/serde/util/parse.rs | crates/core-macros/src/serde/util/parse.rs | use proc_macro2::Span;
use syn::{meta::ParseNestedMeta, parse::Parse};
use super::{RenameAll, RenameRule, PalpoEnumAttrs, UnitVariant, VariantWithSingleField};
impl PalpoEnumAttrs {
/// Try to parse the given meta item and merge it into this `PalpoEnumAttrs`.
///
/// Returns an error if parsing the meta i... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum_from_event.rs | crates/core-macros/src/events/event_enum_from_event.rs | //! Implementation of the `EventEnumFromEvent` derive macro.
use proc_macro2::{Span, TokenStream};
use quote::quote;
/// `EventEnumFromEvent` derive macro code generation.
pub(crate) fn expand_event_enum_from_event(input: syn::DeriveInput) -> syn::Result<TokenStream> {
let event_enum_from_event = EventEnumFromEve... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event.rs | crates/core-macros/src/events/event.rs | //! Implementation of the `Event` derive macro.
use std::{borrow::Cow, fmt};
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use syn::parse_quote;
mod parse;
use super::common::{CommonEventKind, EventVariation};
use crate::util::{NameSpace, to_camel_case};
/// `Event` derive macro code generation.
... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_content.rs | crates/core-macros/src/events/event_content.rs | //! Implementation of the `EventContent` derive macro.
use std::borrow::Cow;
use as_variant::as_variant;
use proc_macro2::TokenStream;
use quote::{ToTokens, format_ident, quote};
use syn::parse_quote;
mod parse;
use super::common::{
CommonEventKind, EventContentTraitVariation, EventType, EventTypes, EventVariat... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum.rs | crates/core-macros/src/events/event_enum.rs | //! Implementation of the `event_enum!` macro.
use std::fmt;
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
mod event_kind_enum;
mod event_type;
mod parse;
mod util;
use self::{
event_kind_enum::EventEnum, event_type::EventTypeEnum, util::expand_json_castable_impl,
};
use super::common::{
C... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/common.rs | crates/core-macros/src/events/common.rs | //! Common types for event macros.
use std::fmt;
use proc_macro2::{Span, TokenStream};
use quote::{ToTokens, format_ident, quote};
use syn::parse::{Parse, ParseStream};
use crate::util::m_prefix_name_to_type_name;
/// All the common event kinds.
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)]
pub(supe... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum/parse.rs | crates/core-macros/src/events/event_enum/parse.rs | //! Parsing helpers specific to the `event_enum!` macro.
use std::collections::BTreeMap;
use proc_macro2::Span;
use syn::{
meta::ParseNestedMeta,
parse::{Parse, ParseStream},
};
use super::{EventEnumData, EventEnumEntry, EventEnumInput};
use crate::events::common::{CommonEventKind, EventType, EventTypes};
i... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum/event_type.rs | crates/core-macros/src/events/event_enum/event_type.rs | //! Functions to generate the `*EventType` enums.
use std::ops::Deref;
use proc_macro2::TokenStream;
use quote::quote;
use super::{EventEnumData, EventEnumKind};
use crate::util::NameSpace;
/// Data to generate an `*EventType` enum.
pub(super) struct EventTypeEnum<'a> {
/// The data for the enum.
data: &'a ... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum/util.rs | crates/core-macros/src/events/event_enum/util.rs | use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use super::EventEnumKind;
use crate::{
events::common::{EventContentTraitVariation, EventVariation},
util::NameSpace,
};
/// Generate `palpo_core::serde::JsonCastable` implementations for all compatible types.
pub(super) fn expand_json_castable_i... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum/event_kind_enum.rs | crates/core-macros/src/events/event_enum/event_kind_enum.rs | use std::ops::Deref;
use proc_macro2::{Span, TokenStream};
use quote::{format_ident, quote};
mod content;
use super::{EventEnumData, EventEnumEntry, EventEnumKind, util::expand_json_castable_impl};
use crate::{
events::common::{CommonEventField, EventContentTraitVariation, EventType, EventVariation},
util::N... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_enum/event_kind_enum/content.rs | crates/core-macros/src/events/event_enum/event_kind_enum/content.rs | //! Functions to generate `Any*EventContent` enums.
use proc_macro2::TokenStream;
use quote::quote;
use crate::{
events::{
common::EventContentTraitVariation,
event_enum::{EventEnum, EventEnumKind},
},
util::NameSpace,
};
impl EventEnum<'_> {
/// Generate the `Any*EventContent` enum f... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event_content/parse.rs | crates/core-macros/src/events/event_content/parse.rs | //! Parsing helpers for the `EventContent` derive macro.
use as_variant::as_variant;
use proc_macro2::{Span, TokenStream};
use syn::{
meta::ParseNestedMeta,
parse::{Parse, ParseStream},
parse_quote,
};
use super::{EventContent, EventContentField, EventContentKind};
use crate::{
events::common::{Common... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core-macros/src/events/event/parse.rs | crates/core-macros/src/events/event/parse.rs | //! Parsing helpers specific to the `Event` derive macro.
use proc_macro2::Span;
use syn::meta::ParseNestedMeta;
use super::{Event, EventField, EventKind};
use crate::{
events::common::EventVariation,
util::{NameSpace, ParseNestedMetaExt},
};
impl Event {
/// Parse the given input as an `Event`.
pub(... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/room_id.rs | crates/identifiers-validation/src/room_id.rs | use crate::{Error, validate_id};
pub fn validate(s: &str) -> Result<(), Error> {
validate_id(s, b'!')
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/user_id.rs | crates/identifiers-validation/src/user_id.rs | use crate::{Error, parse_id};
pub fn validate(s: &str) -> Result<(), Error> {
let colon_idx = parse_id(s, b'@')?;
let localpart = &s[1..colon_idx];
let _ = localpart_is_fully_conforming(localpart)?;
Ok(())
}
/// Check whether the given user id localpart is valid and fully conforming
///
/// Returns a... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/lib.rs | crates/identifiers-validation/src/lib.rs | #![doc(html_favicon_url = "https://palpo.io/favicon.ico")]
#![doc(html_logo_url = "https://palpo.io/images/logo.png")]
pub mod base64_public_key;
pub mod client_secret;
pub mod device_key_id;
pub mod error;
pub mod event_id;
pub mod key_id;
pub mod mxc_uri;
pub mod room_alias_id;
pub mod room_id;
pub mod room_id_or_al... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/server_name.rs | crates/identifiers-validation/src/server_name.rs | use crate::error::Error;
pub fn validate(server_name: &str) -> Result<(), Error> {
use std::net::Ipv6Addr;
if server_name.is_empty() {
return Err(Error::InvalidServerName);
}
let end_of_host = if server_name.starts_with('[') {
let end_of_ipv6 = match server_name.find(']') {
... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/base64_public_key.rs | crates/identifiers-validation/src/base64_public_key.rs | use crate::Error;
pub fn validate(s: &str) -> Result<(), Error> {
if s.is_empty() {
return Err(Error::Empty);
} else if !s
.chars()
.all(|c| c.is_alphanumeric() || matches!(c, '+' | '/' | '='))
{
return Err(Error::InvalidCharacters);
}
Ok(())
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/voip_version_id.rs | crates/identifiers-validation/src/voip_version_id.rs | use crate::{Error, error::VoipVersionIdError};
pub fn validate(u: u64) -> Result<(), Error> {
if u != 0 {
return Err(VoipVersionIdError::WrongUintValue.into());
}
Ok(())
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/server_signing_key_version.rs | crates/identifiers-validation/src/server_signing_key_version.rs | use crate::Error;
pub fn validate(s: &str) -> Result<(), Error> {
if s.is_empty() {
Err(Error::Empty)
} else if !s.chars().all(|c| c.is_alphanumeric() || c == '_') {
Err(Error::InvalidCharacters)
} else {
Ok(())
}
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/room_alias_id.rs | crates/identifiers-validation/src/room_alias_id.rs | use crate::{Error, validate_delimited_id};
pub fn validate(s: &str) -> Result<(), Error> {
validate_delimited_id(s, b'#')
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/space_child_order.rs | crates/identifiers-validation/src/space_child_order.rs | use crate::Error;
/// Validate the `order` of an [`m.space.child`] event.
///
/// According to the specification, the order:
///
/// > Must consist of ASCII characters within the range `\x20` (space) and `\x7E` (~),
/// > inclusive. Must not exceed 50 characters.
///
/// Returns `Ok(())` if the order passes validation... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/client_secret.rs | crates/identifiers-validation/src/client_secret.rs | use crate::Error;
pub fn validate(s: &str) -> Result<(), Error> {
if s.len() > 255 {
return Err(Error::MaximumLengthExceeded);
} else if !s.chars().all(|c| c.is_alphanumeric() || ".=_-".contains(c)) {
return Err(Error::InvalidCharacters);
} else if s.is_empty() {
return Err(Error::E... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/error.rs | crates/identifiers-validation/src/error.rs | //! Error conditions.
use std::str::Utf8Error;
/// An error encountered when trying to parse an invalid ID string.
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// The identifier or a required part of it is empty.
#[error("identifier or required part ... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/event_id.rs | crates/identifiers-validation/src/event_id.rs | use crate::{Error, validate_delimited_id};
pub fn validate(s: &str) -> Result<(), Error> {
if s.contains(':') {
validate_delimited_id(s, b'$')?;
} else if !s.starts_with('$') {
return Err(Error::MissingLeadingSigil);
}
Ok(())
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/room_id_or_alias_id.rs | crates/identifiers-validation/src/room_id_or_alias_id.rs | use crate::Error;
pub fn validate(s: &str) -> Result<(), Error> {
match s.as_bytes().first() {
Some(b'#') => crate::room_alias_id::validate(s),
Some(b'!') => crate::room_id::validate(s),
_ => Err(Error::MissingLeadingSigil),
}
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/key_id.rs | crates/identifiers-validation/src/key_id.rs | use std::num::NonZeroU8;
use crate::{Error, KeyName};
pub fn validate<K: KeyName + ?Sized>(s: &str) -> Result<NonZeroU8, Error> {
let colon_idx =
NonZeroU8::new(s.find(':').ok_or(Error::MissingColon)? as u8).ok_or(Error::MissingColon)?;
K::validate(&s[colon_idx.get() as usize + 1..])?;
Ok(colon_... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/room_version_id.rs | crates/identifiers-validation/src/room_version_id.rs | use crate::Error;
/// Room version identifiers cannot be more than 32 code points.
const MAX_CODE_POINTS: usize = 32;
pub fn validate(s: &str) -> Result<(), Error> {
if s.is_empty() {
Err(Error::Empty)
} else if s.chars().count() > MAX_CODE_POINTS {
Err(Error::MaximumLengthExceeded)
} else... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/device_key_id.rs | crates/identifiers-validation/src/device_key_id.rs | use crate::Error;
pub fn validate(s: &str) -> Result<(), Error> {
let colon_idx = s.find(':').ok_or(Error::MissingColon)?;
if colon_idx == 0 {
Err(Error::Empty)
} else {
// Any non-empty string is accepted as a key algorithm for forwards compatibility
Ok(())
}
}
| rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/identifiers-validation/src/mxc_uri.rs | crates/identifiers-validation/src/mxc_uri.rs | use std::num::NonZeroU8;
use crate::{error::MxcUriError, server_name};
const PROTOCOL: &str = "mxc://";
pub fn validate(uri: &str) -> Result<NonZeroU8, MxcUriError> {
let uri = match uri.strip_prefix(PROTOCOL) {
Some(uri) => uri,
None => return Err(MxcUriError::WrongSchema),
};
let index... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/user.rs | crates/core/src/user.rs | use salvo::oapi::{ToParameters, ToSchema};
use serde::{Deserialize, Serialize};
use crate::{
OwnedMxcUri, OwnedRoomId, OwnedUserId, PrivOwnedStr, events::GlobalAccountDataEventType,
serde::StringEnum,
};
/// Profile fields to specify in query.
///
/// This type can hold an arbitrary string. To build this with... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/third_party_invite.rs | crates/core/src/third_party_invite.rs | //! Common types for [third-party invites].
//!
//! [third-party invites]: https://spec.matrix.org/latest/client-server-api/#third-party-invites
use std::ops::Deref;
use salvo::oapi::ToSchema;
use serde::{Deserialize, Serialize};
use crate::serde::{
Base64, Base64DecodeError,
base64::{Standard, UrlSafe},
};
... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/serde.rs | crates/core/src/serde.rs | //! (De)serialization helpers for other Palpo use crate::s.
//!
//! Part of that is a fork of [serde_urlencoded], with support for sequences in
//! `Deserialize` / `Serialize` structs (e.g. `Vec<Something>`) that are
//! (de)serialized as `field=val1&field=val2`.
//!
//! [serde_urlencoded]: https://github.com/nox/se... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/percent_encode.rs | crates/core/src/percent_encode.rs | use percent_encoding::{AsciiSet, CONTROLS};
/// The [path percent-encode set] as defined in the WHATWG URL standard + `/`
/// since we always encode single segments of the path.
///
/// [path percent-encode set]: https://url.spec.whatwg.org/#path-percent-encode-set
pub(crate) const PATH_PERCENT_ENCODE_SET: &AsciiSet =... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/html.rs | crates/core/src/html.rs | //! Opinionated HTML parsing and manipulating library.
//!
//! Like the rest of the Palpo crates, this crate is primarily meant to be used for
//! the Matrix protocol. It should be able to be used to interact with any HTML
//! document but will offer APIs focused on specificities of HTML in the Matrix
//! specification... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/power_levels.rs | crates/core/src/power_levels.rs | //! Common types for the [`m.room.power_levels` event][power_levels].
//!
//! [power_levels]: https://spec.matrix.org/latest/client-server-api/#mroompower_levels
use salvo::prelude::*;
use serde::{Deserialize, Serialize};
/// The power level requirements for specific notification types.
#[derive(ToSchema, Deserialize,... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/lib.rs | crates/core/src/lib.rs | #![allow(missing_docs, dead_code)]
pub mod appservice;
pub mod authentication;
pub mod client;
pub mod device;
pub mod directory;
pub mod encryption;
pub mod events;
pub mod federation;
#[cfg(feature = "html")]
pub mod html;
pub mod identifiers;
pub mod metadata;
mod percent_encode;
pub mod power_levels;
pub mod prese... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/device.rs | crates/core/src/device.rs | use std::collections::BTreeMap;
use salvo::prelude::*;
use serde::{self, Deserialize, Serialize};
use crate::{
OwnedDeviceId, OwnedTransactionId, OwnedUserId,
encryption::DeviceKeys,
events::{AnyToDeviceEventContent, ToDeviceEventType},
serde::RawJson,
to_device::DeviceIdOrAllDevices,
};
/// Info... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/sending.rs | crates/core/src/sending.rs | use std::{
future::Future,
ops::{Deref, DerefMut},
};
use reqwest::{Client as ReqwestClient, ClientBuilder, Request as ReqwestRequest};
use salvo::http::{HeaderName, HeaderValue, Method, header::CONTENT_TYPE};
use serde::Deserialize;
use thiserror::Error;
use url::{ParseError, Url};
pub fn client() -> Reqwest... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/presence.rs | crates/core/src/presence.rs | //! Common types for the [presence module][presence].
//!
//! [presence]: https://spec.matrix.org/latest/client-server-api/#presence
use salvo::prelude::*;
use serde::{Deserialize, Serialize};
use crate::{OwnedUserId, PrivOwnedStr, serde::StringEnum};
/// A description of a user's connectivity and availability for ch... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/identifiers.rs | crates/core/src/identifiers.rs | //! Types for [Matrix](https://matrix.org/) identifiers for devices, events, keys, rooms, servers,
//! users and URIs.
// FIXME: Remove once lint doesn't trigger on std::convert::TryFrom in identifiers/macros.rs anymore
#![allow(unused_qualifications)]
pub use palpo_identifiers_validation::KeyName;
#[doc(inline)]
pub... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/push.rs | crates/core/src/push.rs | //! Common types for the [push notifications module][push].
//!
//! [push]: https://spec.matrix.org/latest/client-server-api/#push-notifications
//!
//! ## Understanding the types of this module
//!
//! Push rules are grouped in `RuleSet`s, and are grouped in five kinds (for
//! more details about the different kind of... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/signatures.rs | crates/core/src/signatures.rs | //! Digital signatures according to the [Matrix](https://matrix.org/) specification.
//!
//! Digital signatures are used by Matrix homeservers to verify the authenticity
//! of events in the Matrix system, as well as requests between homeservers for
//! federation. Each homeserver has one or more signing key pairs (som... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/third_party.rs | crates/core/src/third_party.rs | //! Common types for the [third party networks module][thirdparty].
//!
//! [thirdparty]: https://spec.matrix.org/latest/client-server-api/#third-party-networks
use std::collections::BTreeMap;
use salvo::prelude::*;
use serde::{Deserialize, Serialize};
use crate::{OwnedRoomAliasId, OwnedUserId, PrivOwnedStr, UnixMil... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/path_builder.rs | crates/core/src/path_builder.rs | //! The `PathBuilder` trait used to construct the path used to query endpoints and the types that
//! implement it.
use std::{
borrow::Cow,
collections::BTreeSet,
fmt::{Display, Write},
};
use konst::{iter, slice, string};
use percent_encoding::utf8_percent_encode;
use tracing::warn;
use super::{FeatureF... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | true |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/encryption.rs | crates/core/src/encryption.rs | //! Common types for [encryption] related tasks.
//!
//! [encryption]: https://spec.matrix.org/latest/client-server-api/#end-to-end-encryption
use std::collections::BTreeMap;
use salvo::prelude::*;
use serde::{Deserialize, Serialize};
use crate::{
EventEncryptionAlgorithm, OwnedDeviceId, OwnedDeviceKeyId, OwnedU... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
palpo-im/palpo | https://github.com/palpo-im/palpo/blob/066b5b15ce094d4e9f6d28484cbc9cb8bd913e67/crates/core/src/time.rs | crates/core/src/time.rs | use std::{
fmt,
time::{Duration, SystemTime, UNIX_EPOCH},
};
use diesel::{AsExpression, FromSqlRow, deserialize::FromSql, pg, serialize::ToSql, sql_types};
use salvo::prelude::*;
use serde::{Deserialize, Serialize};
/// A timestamp represented as the number of milliseconds since the unix epoch.
#[derive(
... | rust | Apache-2.0 | 066b5b15ce094d4e9f6d28484cbc9cb8bd913e67 | 2026-01-04T20:22:21.242775Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.