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 |
|---|---|---|---|---|---|---|---|---|
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/timer.rs | actix-http/src/h1/timer.rs | use std::{fmt, future::Future, pin::Pin, task::Context};
use actix_rt::time::{Instant, Sleep};
use tracing::trace;
#[derive(Debug)]
pub(super) enum TimerState {
Disabled,
Inactive,
Active { timer: Pin<Box<Sleep>> },
}
impl TimerState {
pub(super) fn new(enabled: bool) -> Self {
if enabled {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/expect.rs | actix-http/src/h1/expect.rs | use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ready, Ready};
use crate::{Error, Request};
pub struct ExpectHandler;
impl ServiceFactory<Request> for ExpectHandler {
type Response = Request;
type Error = Error;
type Config = ();
type Service = ExpectHandler;
type InitErro... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/utils.rs | actix-http/src/h1/utils.rs | use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use pin_project_lite::pin_project;
use crate::{
body::{BodySize, MessageBody},
h1::{Codec, Message},
Error, Response,
};
pin_project! {
/// Send HTTP/1 response
pub struct ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/mod.rs | actix-http/src/h1/mod.rs | //! HTTP/1 protocol implementation.
use bytes::{Bytes, BytesMut};
mod chunked;
mod client;
mod codec;
mod decoder;
mod dispatcher;
#[cfg(test)]
mod dispatcher_tests;
mod encoder;
mod expect;
mod payload;
mod service;
mod timer;
mod upgrade;
mod utils;
pub use self::{
client::{ClientCodec, ClientPayloadCodec},
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/payload.rs | actix-http/src/h1/payload.rs | //! Payload stream
use std::{
cell::RefCell,
collections::VecDeque,
pin::Pin,
rc::{Rc, Weak},
task::{Context, Poll, Waker},
};
use bytes::Bytes;
use futures_core::Stream;
use crate::error::PayloadError;
/// max buffer size 32k
pub(crate) const MAX_BUFFER_SIZE: usize = 32_768;
#[derive(Debug, Pa... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/as_name.rs | actix-http/src/header/as_name.rs | //! Sealed [`AsHeaderName`] trait and implementations.
use std::{borrow::Cow, str::FromStr as _};
use http::header::{HeaderName, InvalidHeaderName};
/// Sealed trait implemented for types that can be effectively borrowed as a [`HeaderValue`].
///
/// [`HeaderValue`]: super::HeaderValue
pub trait AsHeaderName: Sealed... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/into_value.rs | actix-http/src/header/into_value.rs | //! [`TryIntoHeaderValue`] trait and implementations.
use bytes::Bytes;
use http::{header::InvalidHeaderValue, Error as HttpError, HeaderValue};
use mime::Mime;
/// An interface for types that can be converted into a [`HeaderValue`].
pub trait TryIntoHeaderValue: Sized {
/// The type returned in the event of a co... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/map.rs | actix-http/src/header/map.rs | //! A multi-value [`HeaderMap`] and its iterators.
use std::{borrow::Cow, collections::hash_map, iter, ops};
use foldhash::{HashMap as FoldHashMap, HashMapExt as _};
use http::header::{HeaderName, HeaderValue};
use smallvec::{smallvec, SmallVec};
use super::AsHeaderName;
/// A multi-map of HTTP headers.
///
/// `He... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | true |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/into_pair.rs | actix-http/src/header/into_pair.rs | //! [`TryIntoHeaderPair`] trait and implementations.
use super::{
Header, HeaderName, HeaderValue, InvalidHeaderName, InvalidHeaderValue, TryIntoHeaderValue,
};
use crate::error::HttpError;
/// An interface for types that can be converted into a [`HeaderName`] + [`HeaderValue`] pair for
/// insertion into a [`Hea... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/utils.rs | actix-http/src/header/utils.rs | //! Header parsing utilities.
use std::{fmt, str::FromStr};
use super::HeaderValue;
use crate::{error::ParseError, header::HTTP_VALUE};
/// Reads a comma-delimited raw header into a Vec.
#[inline]
pub fn from_comma_delimited<'a, I, T>(all: I) -> Result<Vec<T>, ParseError>
where
I: Iterator<Item = &'a HeaderValue... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/mod.rs | actix-http/src/header/mod.rs | //! Pre-defined `HeaderName`s, traits for parsing and conversion, and other header utility methods.
// declaring new header consts will yield this error
#![allow(clippy::declare_interior_mutable_const)]
// re-export from http except header map related items
pub use ::http::header::{
HeaderName, HeaderValue, Inval... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/common.rs | actix-http/src/header/common.rs | //! Common header names not defined in [`http`].
//!
//! Any headers added to this file will need to be re-exported from the list at `crate::headers`.
use http::header::HeaderName;
/// Response header field that indicates how caches have handled that response and its corresponding
/// request.
///
/// See [RFC 9211](... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/charset.rs | actix-http/src/header/shared/charset.rs | use std::{fmt, str};
use self::Charset::*;
/// A MIME character set.
///
/// The string representation is normalized to upper case.
///
/// See <http://www.iana.org/assignments/character-sets/character-sets.xhtml>.
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum Charset {
/// US ASC... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/http_date.rs | actix-http/src/header/shared/http_date.rs | use std::{fmt, io::Write, str::FromStr, time::SystemTime};
use bytes::BytesMut;
use http::header::{HeaderValue, InvalidHeaderValue};
use crate::{
date::DATE_VALUE_LENGTH, error::ParseError, header::TryIntoHeaderValue, helpers::MutWriter,
};
/// A timestamp with HTTP-style formatting and parsing.
#[derive(Clone, ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/quality.rs | actix-http/src/header/shared/quality.rs | use std::fmt;
use derive_more::{Display, Error};
const MAX_QUALITY_INT: u16 = 1000;
const MAX_QUALITY_FLOAT: f32 = 1.0;
/// Represents a quality used in q-factor values.
///
/// The default value is equivalent to `q=1.0` (the [max](Self::MAX) value).
///
/// # Implementation notes
/// The quality value is defined as... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/content_encoding.rs | actix-http/src/header/shared/content_encoding.rs | use std::str::FromStr;
use derive_more::{Display, Error};
use http::header::InvalidHeaderValue;
use crate::{
error::ParseError,
header::{self, from_one_raw_str, Header, HeaderName, HeaderValue, TryIntoHeaderValue},
HttpMessage,
};
/// Error returned when a content encoding is unknown.
#[derive(Debug, Dis... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/mod.rs | actix-http/src/header/shared/mod.rs | //! Originally taken from `hyper::header::shared`.
pub use language_tags::LanguageTag;
mod charset;
mod content_encoding;
mod extended;
mod http_date;
mod quality;
mod quality_item;
pub use self::{
charset::Charset,
content_encoding::ContentEncoding,
extended::{parse_extended_value, ExtendedValue},
h... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/quality_item.rs | actix-http/src/header/shared/quality_item.rs | use std::{cmp, fmt, str};
use super::Quality;
use crate::error::ParseError;
/// Represents an item with a quality value as defined
/// in [RFC 7231 §5.3.1](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.1).
///
/// # Parsing and Formatting
/// This wrapper be used to parse header value items that have a q-... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/header/shared/extended.rs | actix-http/src/header/shared/extended.rs | //! Originally taken from `hyper::header::parsing`.
use std::{fmt, str::FromStr};
use language_tags::LanguageTag;
use crate::header::{Charset, HTTP_VALUE};
/// The value part of an extended parameter consisting of three parts:
/// - The REQUIRED character set name (`charset`).
/// - The OPTIONAL language informatio... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/responses/builder.rs | actix-http/src/responses/builder.rs | //! HTTP response builder.
use std::{cell::RefCell, fmt, str};
use crate::{
body::{EitherBody, MessageBody},
error::{Error, HttpError},
header::{self, TryIntoHeaderPair, TryIntoHeaderValue},
responses::{BoxedResponseHead, ResponseHead},
ConnectionType, Extensions, Response, StatusCode,
};
/// An ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/responses/response.rs | actix-http/src/responses/response.rs | //! HTTP response.
use std::{
cell::{Ref, RefCell, RefMut},
fmt, str,
};
use bytes::{Bytes, BytesMut};
use bytestring::ByteString;
use crate::{
body::{BoxBody, EitherBody, MessageBody},
header::{self, HeaderMap, TryIntoHeaderValue},
responses::BoxedResponseHead,
Error, Extensions, ResponseBui... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/responses/mod.rs | actix-http/src/responses/mod.rs | //! HTTP response.
mod builder;
mod head;
#[allow(clippy::module_inception)]
mod response;
pub(crate) use self::head::BoxedResponseHead;
pub use self::{builder::ResponseBuilder, head::ResponseHead, response::Response};
| rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/responses/head.rs | actix-http/src/responses/head.rs | //! Response head type and caching pool.
use std::{cell::RefCell, ops};
use crate::{header::HeaderMap, message::Flags, ConnectionType, StatusCode, Version};
thread_local! {
static RESPONSE_POOL: BoxedResponsePool = BoxedResponsePool::create();
}
#[derive(Debug, Clone)]
pub struct ResponseHead {
pub version:... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/tests/test_server.rs | actix-http/tests/test_server.rs | use std::{
convert::Infallible,
io::{Read, Write},
net, thread,
time::{Duration, Instant},
};
use actix_http::{
body::{self, BodyStream, BoxBody, SizedStream},
header, Error, HttpService, KeepAlive, Request, Response, StatusCode, Version,
};
use actix_http_test::test_server;
use actix_rt::{net:... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/tests/test_client.rs | actix-http/tests/test_client.rs | use std::convert::Infallible;
use actix_http::{body::BoxBody, HttpMessage, HttpService, Request, Response, StatusCode};
use actix_http_test::test_server;
use actix_service::ServiceFactoryExt;
use actix_utils::future;
use bytes::Bytes;
use derive_more::{Display, Error};
use futures_util::StreamExt as _;
const STR: &st... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/tests/test_ws.rs | actix-http/tests/test_ws.rs | use std::{
cell::Cell,
convert::Infallible,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_http::{
body::{BodySize, BoxBody},
h1,
ws::{self, CloseCode, Frame, Item, Message},
Error, HttpService, Request, Response,
};
use actix_http_test::test_server;
u... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/tests/test_rustls.rs | actix-http/tests/test_rustls.rs | #![cfg(feature = "rustls-0_23")]
extern crate tls_rustls_023 as rustls;
use std::{
convert::Infallible,
io::{self, Write},
net::{SocketAddr, TcpStream as StdTcpStream},
sync::Arc,
task::Poll,
time::Duration,
};
use actix_http::{
body::{BodyStream, BoxBody, SizedStream},
error::Payload... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/tests/test_openssl.rs | actix-http/tests/test_openssl.rs | #![cfg(feature = "openssl")]
extern crate tls_openssl as openssl;
use std::{convert::Infallible, io, time::Duration};
use actix_http::{
body::{BodyStream, BoxBody, SizedStream},
error::PayloadError,
header::{self, HeaderValue},
Error, HttpService, Method, Request, Response, StatusCode, TlsAcceptorCon... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/tests/test_h2_timer.rs | actix-http/tests/test_h2_timer.rs | use std::{io, time::Duration};
use actix_http::{error::Error, HttpService, Response};
use actix_server::Server;
use tokio::io::AsyncWriteExt;
#[actix_rt::test]
async fn h2_ping_pong() -> io::Result<()> {
let (tx, rx) = std::sync::mpsc::sync_channel(1);
let lst = std::net::TcpListener::bind("127.0.0.1:0")?;
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/benches/date-formatting.rs | actix-http/benches/date-formatting.rs | use std::time::SystemTime;
use actix_http::header::HttpDate;
use divan::{black_box, AllocProfiler, Bencher};
#[global_allocator]
static ALLOC: AllocProfiler = AllocProfiler::system();
#[divan::bench]
fn date_formatting(b: Bencher<'_, '_>) {
let now = SystemTime::now();
b.bench(|| {
black_box(HttpDat... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/benches/response-body-compression.rs | actix-http/benches/response-body-compression.rs | use std::convert::Infallible;
use actix_http::{encoding::Encoder, ContentEncoding, Request, Response, StatusCode};
use actix_service::{fn_service, Service as _};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
static BODY: &[u8] = include_bytes!("../Cargo.toml");
fn compression_responses(c: &... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/tls_rustls.rs | actix-http/examples/tls_rustls.rs | //! Demonstrates TLS configuration (via Rustls) for HTTP/1.1 and HTTP/2 connections.
//!
//! Test using cURL:
//!
//! ```console
//! $ curl --insecure https://127.0.0.1:8443
//! Hello World!
//! Protocol: HTTP/2.0
//!
//! $ curl --insecure --http1.1 https://127.0.0.1:8443
//! Hello World!
//! Protocol: HTTP/1.1
//! ```... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/bench.rs | actix-http/examples/bench.rs | use std::{convert::Infallible, io, time::Duration};
use actix_http::{HttpService, Request, Response, StatusCode};
use actix_server::Server;
use once_cell::sync::Lazy;
static STR: Lazy<String> = Lazy::new(|| "HELLO WORLD ".repeat(20));
#[actix_rt::main]
async fn main() -> io::Result<()> {
env_logger::init_from_en... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/h2spec.rs | actix-http/examples/h2spec.rs | use std::{convert::Infallible, io};
use actix_http::{HttpService, Request, Response, StatusCode};
use actix_server::Server;
use once_cell::sync::Lazy;
static STR: Lazy<String> = Lazy::new(|| "HELLO WORLD ".repeat(100));
#[actix_rt::main]
async fn main() -> io::Result<()> {
env_logger::init_from_env(env_logger::E... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/hello-world.rs | actix-http/examples/hello-world.rs | use std::{convert::Infallible, io, time::Duration};
use actix_http::{header::HeaderValue, HttpService, Request, Response, StatusCode};
use actix_server::Server;
use tracing::info;
#[actix_rt::main]
async fn main() -> io::Result<()> {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/streaming-error.rs | actix-http/examples/streaming-error.rs | //! Example showing response body (chunked) stream erroring.
//!
//! Test using `nc` or `curl`.
//! ```sh
//! $ curl -vN 127.0.0.1:8080
//! $ echo 'GET / HTTP/1.1\n\n' | nc 127.0.0.1 8080
//! ```
use std::{convert::Infallible, io, time::Duration};
use actix_http::{body::BodyStream, HttpService, Response};
use actix_s... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/echo.rs | actix-http/examples/echo.rs | use std::{io, time::Duration};
use actix_http::{Error, HttpService, Request, Response, StatusCode};
use actix_server::Server;
use bytes::BytesMut;
use futures_util::StreamExt as _;
use http::header::HeaderValue;
use tracing::info;
#[actix_rt::main]
async fn main() -> io::Result<()> {
env_logger::init_from_env(env... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/h2c-detect.rs | actix-http/examples/h2c-detect.rs | //! An example that supports automatic selection of plaintext h1/h2c connections.
//!
//! Notably, both the following commands will work.
//! ```console
//! $ curl --http1.1 'http://localhost:8080/'
//! $ curl --http2-prior-knowledge 'http://localhost:8080/'
//! ```
use std::{convert::Infallible, io};
use actix_http:... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/ws.rs | actix-http/examples/ws.rs | //! Sets up a WebSocket server over TCP and TLS.
//! Sends a heartbeat message every 4 seconds but does not respond to any incoming frames.
extern crate tls_rustls_023 as rustls;
use std::{
io,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use actix_http::{body::BodyStream, error::Error, ws, Ht... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/echo2.rs | actix-http/examples/echo2.rs | use std::io;
use actix_http::{
body::{BodyStream, MessageBody},
header, Error, HttpMessage, HttpService, Request, Response, StatusCode,
};
async fn handle_request(mut req: Request) -> Result<Response<impl MessageBody>, Error> {
let mut res = Response::build(StatusCode::OK);
if let Some(ct) = req.head... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/examples/actix-web.rs | actix-http/examples/actix-web.rs | use actix_http::HttpService;
use actix_server::Server;
use actix_service::map_config;
use actix_web::{dev::AppConfig, get, App, Responder};
#[get("/")]
async fn index() -> impl Responder {
"Hello, world. From Actix Web!"
}
#[tokio::main(flavor = "current_thread")]
async fn main() -> std::io::Result<()> {
Serv... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http-test/src/lib.rs | actix-http-test/src/lib.rs | //! Various helpers for Actix applications to use during testing.
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(feature = "openssl")]
extern crate tls_openssl as openssl;
use std::{net, thread, time::Du... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/src/lib.rs | actix-multipart-derive/src/lib.rs | //! Multipart form derive macro for Actix Web.
//!
//! See [`macro@MultipartForm`] for usage examples.
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::disallowed_names)] // false positives in som... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild.rs | actix-multipart-derive/tests/trybuild.rs | #[rustversion_msrv::msrv]
#[test]
fn compile_macros() {
let t = trybuild::TestCases::new();
t.pass("tests/trybuild/all-required.rs");
t.pass("tests/trybuild/optional-and-list.rs");
t.pass("tests/trybuild/rename.rs");
t.pass("tests/trybuild/deny-unknown.rs");
t.pass("tests/trybuild/deny-duplica... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/rename.rs | actix-multipart-derive/tests/trybuild/rename.rs | use actix_web::{web, App, Responder};
use actix_multipart::form::{tempfile::TempFile, MultipartForm};
#[derive(MultipartForm)]
struct Form {
#[multipart(rename = "files[]")]
files: Vec<TempFile>,
}
async fn handler(_form: MultipartForm<Form>) -> impl Responder {
"Hello World!"
}
#[actix_web::main]
async... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/optional-and-list.rs | actix-multipart-derive/tests/trybuild/optional-and-list.rs | use actix_web::{web, App, Responder};
use actix_multipart::form::{tempfile::TempFile, text::Text, MultipartForm};
#[derive(MultipartForm)]
struct Form {
category: Option<Text<String>>,
files: Vec<TempFile>,
}
async fn handler(_form: MultipartForm<Form>) -> impl Responder {
"Hello World!"
}
#[actix_web::... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/size-limit-parse-fail.rs | actix-multipart-derive/tests/trybuild/size-limit-parse-fail.rs | use actix_multipart::form::{text::Text, MultipartForm};
#[derive(MultipartForm)]
struct Form {
#[multipart(limit = "2 bytes")]
description: Text<String>,
}
#[derive(MultipartForm)]
struct Form2 {
#[multipart(limit = "2 megabytes")]
description: Text<String>,
}
#[derive(MultipartForm)]
struct Form3 {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/deny-parse-fail.rs | actix-multipart-derive/tests/trybuild/deny-parse-fail.rs | use actix_multipart::form::MultipartForm;
#[derive(MultipartForm)]
#[multipart(duplicate_field = "no")]
struct Form {}
fn main() {}
| rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/all-required.rs | actix-multipart-derive/tests/trybuild/all-required.rs | use actix_web::{web, App, Responder};
use actix_multipart::form::{tempfile::TempFile, text::Text, MultipartForm};
#[derive(Debug, MultipartForm)]
struct ImageUpload {
description: Text<String>,
timestamp: Text<i64>,
image: TempFile,
}
async fn handler(_form: MultipartForm<ImageUpload>) -> impl Responder ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/deny-duplicates.rs | actix-multipart-derive/tests/trybuild/deny-duplicates.rs | use actix_web::{web, App, Responder};
use actix_multipart::form::MultipartForm;
#[derive(MultipartForm)]
#[multipart(duplicate_field = "deny")]
struct Form {}
async fn handler(_form: MultipartForm<Form>) -> impl Responder {
"Hello World!"
}
#[actix_web::main]
async fn main() {
App::new().default_service(web... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/size-limits.rs | actix-multipart-derive/tests/trybuild/size-limits.rs | use actix_web::{web, App, Responder};
use actix_multipart::form::{tempfile::TempFile, text::Text, MultipartForm};
#[derive(MultipartForm)]
struct Form {
#[multipart(limit = "2 KiB")]
description: Text<String>,
#[multipart(limit = "512 MiB")]
files: Vec<TempFile>,
}
async fn handler(_form: MultipartF... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-multipart-derive/tests/trybuild/deny-unknown.rs | actix-multipart-derive/tests/trybuild/deny-unknown.rs | use actix_web::{web, App, Responder};
use actix_multipart::form::MultipartForm;
#[derive(MultipartForm)]
#[multipart(deny_unknown_fields)]
struct Form {}
async fn handler(_form: MultipartForm<Form>) -> impl Responder {
"Hello World!"
}
#[actix_web::main]
async fn main() {
App::new().default_service(web::to(... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/fuzz/fuzz_targets/ruff_parse_simple.rs | fuzz/fuzz_targets/ruff_parse_simple.rs | //! Fuzzer harness which merely explores the parse/unparse coverage space and tries to make it
//! crash. On its own, this fuzzer is (hopefully) not going to find a crash.
#![no_main]
use libfuzzer_sys::{fuzz_target, Corpus};
use ruff_python_codegen::{Generator, Stylist};
use ruff_python_parser::{parse_module, ParseE... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/fuzz/fuzz_targets/ruff_formatter_idempotency.rs | fuzz/fuzz_targets/ruff_formatter_idempotency.rs | //! Fuzzer harness which double formats the input and access the idempotency or unsteady state of the
//! ruff's formatter.
#![no_main]
use libfuzzer_sys::{fuzz_target, Corpus};
use similar::TextDiff;
use ruff_python_formatter::{format_module_source, PyFormatOptions};
fn do_fuzz(case: &[u8]) -> Corpus {
// Thro... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/fuzz/fuzz_targets/ruff_formatter_validity.rs | fuzz/fuzz_targets/ruff_formatter_validity.rs | //! Fuzzer harness which actively tries to find testcases that cause Ruff to introduce errors into
//! the resulting file.
#![no_main]
use std::collections::HashMap;
use std::sync::OnceLock;
use libfuzzer_sys::{fuzz_target, Corpus};
use ruff_linter::linter::ParseSource;
use ruff_linter::settings::flags::Noqa;
use ru... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/fuzz/fuzz_targets/ty_check_invalid_syntax.rs | fuzz/fuzz_targets/ty_check_invalid_syntax.rs | //! Fuzzer harness that runs the type checker to catch for panics for source code containing
//! syntax errors.
#![no_main]
use std::sync::{Arc, Mutex, OnceLock};
use libfuzzer_sys::{Corpus, fuzz_target};
use ruff_db::Db as SourceDb;
use ruff_db::files::{File, Files, system_path_to_file};
use ruff_db::system::{
... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/fuzz/fuzz_targets/ruff_parse_idempotency.rs | fuzz/fuzz_targets/ruff_parse_idempotency.rs | //! Fuzzer harness which searches for situations where the parser does not parse or unparse a
//! particular source snippet consistently.
#![no_main]
use libfuzzer_sys::{fuzz_target, Corpus};
use ruff_python_codegen::round_trip;
use similar::TextDiff;
fn do_fuzz(case: &[u8]) -> Corpus {
let Ok(code) = std::str::... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/fuzz/fuzz_targets/ruff_fix_validity.rs | fuzz/fuzz_targets/ruff_fix_validity.rs | //! Fuzzer harness which actively tries to find testcases that cause Ruff to introduce errors into
//! the resulting file.
#![no_main]
use libfuzzer_sys::{fuzz_target, Corpus};
use ruff_linter::settings::LinterSettings;
use std::sync::OnceLock;
static SETTINGS: OnceLock<LinterSettings> = OnceLock::new();
fn do_fuzz... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_diagnostics/src/source_map.rs | crates/ruff_diagnostics/src/source_map.rs | use ruff_text_size::{Ranged, TextSize};
use crate::Edit;
/// Lightweight sourcemap marker representing the source and destination
/// position for an [`Edit`].
#[derive(Debug, PartialEq, Eq)]
pub struct SourceMarker {
/// Position of the marker in the original source.
source: TextSize,
/// Position of the... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_diagnostics/src/lib.rs | crates/ruff_diagnostics/src/lib.rs | pub use edit::Edit;
pub use fix::{Applicability, Fix, IsolationLevel};
pub use source_map::{SourceMap, SourceMarker};
mod edit;
mod fix;
mod source_map;
| rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_diagnostics/src/fix.rs | crates/ruff_diagnostics/src/fix.rs | #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use ruff_text_size::{Ranged, TextSize};
use crate::edit::Edit;
/// Indicates if a fix can be applied.
#[derive(
Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, is_macro::Is, get_size2::GetSize,
)]
#[cfg_attr(feature = "serde", derive(Serial... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_diagnostics/src/edit.rs | crates/ruff_diagnostics/src/edit.rs | use std::cmp::Ordering;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use ruff_text_size::{Ranged, TextRange, TextSize};
/// A text edit to be applied to a source file. Inserts, deletes, or replaces
/// content at a given location.
#[derive(Clone, Debug, PartialEq, Eq, Hash, get_size2::GetSize)]
#[c... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/src/lib.rs | crates/ruff_benchmark/src/lib.rs | use std::path::PathBuf;
#[cfg(any(feature = "ty_instrumented", feature = "ruff_instrumented"))]
pub mod criterion;
pub mod real_world_projects;
pub static NUMPY_GLOBALS: TestFile = TestFile::new(
"numpy/globals.py",
include_str!("../resources/numpy/globals.py"),
);
pub static UNICODE_PYPINYIN: TestFile = Tes... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/src/real_world_projects.rs | crates/ruff_benchmark/src/real_world_projects.rs | #![allow(clippy::print_stderr)]
//! Infrastructure for benchmarking real-world Python projects.
//!
//! The module uses a setup similar to mypy primer's, which should make it easy
//! to add new benchmarks for projects in [mypy primer's project's list](https://github.com/hauntsaninja/mypy_primer/blob/ebaa9fd27b51a2788... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/src/criterion.rs | crates/ruff_benchmark/src/criterion.rs | //! This module re-exports the criterion API but picks the right backend depending on whether
//! the benchmarks are built to run locally or with codspeed.
//! The compat layer is required because codspeed doesn't support all platforms.
//! See [#12662](https://github.com/astral-sh/ruff/issues/12662)
#[cfg(not(codspee... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/benches/linter.rs | crates/ruff_benchmark/benches/linter.rs | use ruff_benchmark::criterion;
use criterion::{
BenchmarkGroup, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main,
};
use ruff_benchmark::{
LARGE_DATASET, NUMPY_CTYPESLIB, NUMPY_GLOBALS, PYDANTIC_TYPES, TestCase, UNICODE_PYPINYIN,
};
use ruff_linter::linter::{ParseSource, lint_only};
use ruff... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/benches/lexer.rs | crates/ruff_benchmark/benches/lexer.rs | use ruff_benchmark::criterion;
use criterion::{
BenchmarkId, Criterion, Throughput, criterion_group, criterion_main, measurement::WallTime,
};
use ruff_benchmark::{
LARGE_DATASET, NUMPY_CTYPESLIB, NUMPY_GLOBALS, PYDANTIC_TYPES, TestCase, UNICODE_PYPINYIN,
};
use ruff_python_ast::token::TokenKind;
use ruff_pyth... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/benches/parser.rs | crates/ruff_benchmark/benches/parser.rs | use ruff_benchmark::criterion;
use criterion::{
BenchmarkId, Criterion, Throughput, criterion_group, criterion_main, measurement::WallTime,
};
use ruff_benchmark::{
LARGE_DATASET, NUMPY_CTYPESLIB, NUMPY_GLOBALS, PYDANTIC_TYPES, TestCase, UNICODE_PYPINYIN,
};
use ruff_python_ast::Stmt;
use ruff_python_ast::stat... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/benches/ty_walltime.rs | crates/ruff_benchmark/benches/ty_walltime.rs | use divan::{Bencher, bench};
use std::fmt::{Display, Formatter};
use rayon::ThreadPoolBuilder;
use ruff_benchmark::real_world_projects::{InstalledProject, RealWorldProject};
use ruff_db::system::{OsSystem, SystemPath, SystemPathBuf};
use ruff_db::testing::setup_logging_with_filter;
use ruff_python_ast::PythonVersion;... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/benches/ty.rs | crates/ruff_benchmark/benches/ty.rs | #![allow(clippy::disallowed_names)]
use ruff_benchmark::criterion;
use ruff_benchmark::real_world_projects::{InstalledProject, RealWorldProject};
use std::fmt::Write;
use std::ops::Range;
use criterion::{BatchSize, Criterion, criterion_group, criterion_main};
use rayon::ThreadPoolBuilder;
use rustc_hash::FxHashSet;
... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_benchmark/benches/formatter.rs | crates/ruff_benchmark/benches/formatter.rs | use std::path::Path;
use ruff_benchmark::criterion::{
BenchmarkId, Criterion, Throughput, criterion_group, criterion_main,
};
use ruff_benchmark::{
LARGE_DATASET, NUMPY_CTYPESLIB, NUMPY_GLOBALS, PYDANTIC_TYPES, TestCase, UNICODE_PYPINYIN,
};
use ruff_python_formatter::{PreviewMode, PyFormatOptions, format_mod... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/dunder_all.rs | crates/ty_python_semantic/src/dunder_all.rs | use rustc_hash::FxHashSet;
use ruff_db::files::File;
use ruff_db::parsed::parsed_module;
use ruff_python_ast::name::Name;
use ruff_python_ast::statement_visitor::{StatementVisitor, walk_stmt};
use ruff_python_ast::{self as ast};
use ty_module_resolver::{ModuleName, resolve_module};
use crate::Db;
use crate::semantic_... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/db.rs | crates/ty_python_semantic/src/db.rs | use crate::AnalysisSettings;
use crate::lint::{LintRegistry, RuleSelection};
use ruff_db::files::File;
use ty_module_resolver::Db as ModuleResolverDb;
/// Database giving access to semantic information about a Python program.
#[salsa::db]
pub trait Db: ModuleResolverDb {
/// Returns `true` if the file should be ch... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/lib.rs | crates/ty_python_semantic/src/lib.rs | #![warn(
clippy::disallowed_methods,
reason = "Prefer System trait methods over std methods in ty crates"
)]
use std::hash::BuildHasherDefault;
use crate::lint::{LintRegistry, LintRegistryBuilder};
use crate::suppression::{
IGNORE_COMMENT_UNKNOWN_RULE, INVALID_IGNORE_COMMENT, UNUSED_IGNORE_COMMENT,
};
pub ... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/place.rs | crates/ty_python_semantic/src/place.rs | use ruff_db::files::File;
use ruff_python_ast::PythonVersion;
use ty_module_resolver::{
KnownModule, Module, ModuleName, file_to_module, resolve_module_confident,
};
use crate::dunder_all::dunder_all_names;
use crate::semantic_index::definition::{Definition, DefinitionState};
use crate::semantic_index::place::{Pla... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/program.rs | crates/ty_python_semantic/src/program.rs | use std::sync::Arc;
use crate::Db;
use crate::python_platform::PythonPlatform;
use ruff_db::diagnostic::Span;
use ruff_db::files::system_path_to_file;
use ruff_db::system::{SystemPath, SystemPathBuf};
use ruff_python_ast::PythonVersion;
use ruff_text_size::TextRange;
use salsa::Durability;
use salsa::Setter;
use ty_m... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/suppression.rs | crates/ty_python_semantic/src/suppression.rs | mod add_ignore;
mod parser;
mod unused;
use smallvec::SmallVec;
use std::fmt;
use ruff_db::diagnostic::{
Annotation, Diagnostic, DiagnosticId, IntoDiagnosticMessage, Severity, Span,
};
use ruff_db::{files::File, parsed::parsed_module, source::source_text};
use ruff_python_ast::token::TokenKind;
use ruff_text_size... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/list.rs | crates/ty_python_semantic/src/list.rs | //! Sorted, arena-allocated association lists
//!
//! An [_association list_][alist], which is a linked list of key/value pairs. We additionally
//! guarantee that the elements of an association list are sorted (by their keys), and that they do
//! not contain any entries with duplicate keys.
//!
//! Association lists ... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/lint.rs | crates/ty_python_semantic/src/lint.rs | use crate::diagnostic::did_you_mean;
use core::fmt;
use itertools::Itertools;
use ruff_db::diagnostic::{DiagnosticId, LintName, Severity};
use rustc_hash::FxHashMap;
use std::error::Error;
use std::fmt::Formatter;
use std::hash::Hasher;
#[derive(Debug, Clone)]
pub struct LintMetadata {
/// The unique identifier fo... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types.rs | crates/ty_python_semantic/src/types.rs | use compact_str::CompactString;
use infer::nearest_enclosing_class;
use itertools::{Either, Itertools};
use ruff_diagnostics::{Edit, Fix};
use std::borrow::Cow;
use std::cell::RefCell;
use std::time::Duration;
use bitflags::bitflags;
use call::{CallDunderError, CallError, CallErrorKind};
use context::InferContext;
us... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/ast_node_ref.rs | crates/ty_python_semantic/src/ast_node_ref.rs | use std::fmt::Debug;
use std::marker::PhantomData;
#[cfg(debug_assertions)]
use ruff_db::files::File;
use ruff_db::parsed::ParsedModuleRef;
use ruff_python_ast::{AnyNodeRef, NodeIndex};
use ruff_python_ast::{AnyRootNodeRef, HasNodeIndex};
use ruff_text_size::Ranged;
/// Reference to an AST node.
///
/// This type act... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/python_platform.rs | crates/ty_python_semantic/src/python_platform.rs | use std::fmt::{Display, Formatter};
use ty_combine::Combine;
/// The target platform to assume when resolving types.
#[derive(Debug, Clone, PartialEq, Eq, get_size2::GetSize)]
#[cfg_attr(
feature = "serde",
derive(serde::Serialize, serde::Deserialize, ruff_macros::RustDoc),
serde(rename_all = "kebab-case")... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/semantic_index.rs | crates/ty_python_semantic/src/semantic_index.rs | use std::iter::{FusedIterator, once};
use std::sync::Arc;
use ruff_db::files::File;
use ruff_db::parsed::parsed_module;
use ruff_index::{IndexSlice, IndexVec};
use ruff_python_ast::NodeIndex;
use ruff_python_parser::semantic_errors::SemanticSyntaxError;
use rustc_hash::{FxHashMap, FxHashSet};
use salsa::Update;
use sa... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/pull_types.rs | crates/ty_python_semantic/src/pull_types.rs | //! A utility visitor for testing, which attempts to "pull a type" for ever sub-node in a given AST.
//!
//! This is used in the "corpus" and (indirectly) the "mdtest" integration tests for this crate.
//! (Mdtest uses the `pull_types` function via the `ty_test` crate.)
use crate::{Db, HasType, SemanticModel};
use ruf... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/rank.rs | crates/ty_python_semantic/src/rank.rs | //! A boxed bit slice that supports a constant-time `rank` operation.
use bitvec::prelude::{BitBox, Msb0};
use get_size2::GetSize;
/// A boxed bit slice that supports a constant-time `rank` operation.
///
/// This can be used to "shrink" a large vector, where you only need to keep certain elements, and
/// you want t... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/node_key.rs | crates/ty_python_semantic/src/node_key.rs | use ruff_python_ast::{HasNodeIndex, NodeIndex};
use crate::ast_node_ref::AstNodeRef;
/// Compact key for a node for use in a hash map.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, get_size2::GetSize)]
pub(super) struct NodeKey(NodeIndex);
impl NodeKey {
pub(super) fn from_node<N>(node: N) -> Self
where
... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/site_packages.rs | crates/ty_python_semantic/src/site_packages.rs | //! Utilities for finding the `site-packages` directory,
//! into which third-party packages are installed.
//!
//! The routines exposed by this module have different behaviour depending
//! on the platform of the *host machine*, which may be
//! different from the *target platform for type checking*. (A user
//! might... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/unpack.rs | crates/ty_python_semantic/src/unpack.rs | use ruff_db::files::File;
use ruff_db::parsed::ParsedModuleRef;
use ruff_python_ast::{self as ast, AnyNodeRef};
use ruff_text_size::{Ranged, TextRange};
use crate::Db;
use crate::ast_node_ref::AstNodeRef;
use crate::semantic_index::expression::Expression;
use crate::semantic_index::scope::{FileScopeId, ScopeId};
/// ... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/subscript.rs | crates/ty_python_semantic/src/subscript.rs | //! This module provides utility functions for indexing (`PyIndex`) and slicing
//! operations (`PySlice`) on iterators, following the semantics of equivalent
//! operations in Python.
use itertools::Either;
use crate::Db;
#[derive(Debug, Clone, Copy, PartialEq)]
pub(crate) struct OutOfBoundsError;
pub(crate) trait... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/semantic_model.rs | crates/ty_python_semantic/src/semantic_model.rs | use ruff_db::files::{File, FilePath};
use ruff_db::source::{line_index, source_text};
use ruff_python_ast::{self as ast, ExprStringLiteral, ModExpression};
use ruff_python_ast::{Expr, ExprRef, HasNodeIndex, name::Name};
use ruff_python_parser::Parsed;
use ruff_source_file::LineIndex;
use rustc_hash::FxHashMap;
use ty_m... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/diagnostic.rs | crates/ty_python_semantic/src/diagnostic.rs | use crate::{
Db, Program, PythonVersionWithSource, lint::lint_documentation_url, types::TypeCheckDiagnostics,
};
use ruff_db::{
diagnostic::{Annotation, Diagnostic, DiagnosticId, SubDiagnostic, SubDiagnosticSeverity},
files::File,
};
use std::cell::RefCell;
use std::fmt::Write;
/// Suggest a name from `exi... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/list_members.rs | crates/ty_python_semantic/src/types/list_members.rs | //! Routines and types to list all members present on a given type or in a given scope.
//!
//! These two concepts are closely related, since listing all members of a given
//! module-literal type requires listing all members in the module's scope, and
//! listing all members on a nominal-instance type or a class-liter... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/newtype.rs | crates/ty_python_semantic/src/types/newtype.rs | use std::collections::BTreeSet;
use crate::Db;
use crate::semantic_index::definition::{Definition, DefinitionKind};
use crate::types::constraints::ConstraintSet;
use crate::types::{ClassType, KnownUnion, Type, definition_expression_type, visitor};
use ruff_db::parsed::parsed_module;
use ruff_python_ast as ast;
/// A ... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/infer.rs | crates/ty_python_semantic/src/types/infer.rs | //! We have Salsa queries for inferring types at three different granularities: scope-level,
//! definition-level, and expression-level.
//!
//! Scope-level inference is for when we are actually checking a file, and need to check types for
//! everything in that file's scopes, or give a linter access to types of arbitr... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/cyclic.rs | crates/ty_python_semantic/src/types/cyclic.rs | //! Cycle detection for recursive types.
//!
//! The visitors here (`TypeTransformer` and `PairVisitor`) are used in methods that recursively
//! visit types to transform them (e.g. `Type::normalize`) or to decide a relation between a pair
//! of types (e.g. `Type::has_relation_to`).
//!
//! The typical pattern is that... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/visitor.rs | crates/ty_python_semantic/src/types/visitor.rs | use crate::{
Db, FxIndexSet,
types::{
BoundMethodType, BoundSuperType, BoundTypeVarInstance, CallableType, GenericAlias,
IntersectionType, KnownBoundMethodType, KnownInstanceType, NominalInstanceType,
PropertyInstanceType, ProtocolInstanceType, SubclassOfType, Type, TypeAliasType,
... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/builder.rs | crates/ty_python_semantic/src/types/builder.rs | //! Smart builders for union and intersection types.
//!
//! Invariants we maintain here:
//! * No single-element union types (should just be the contained type instead.)
//! * No single-positive-element intersection types. Single-negative-element are OK, we don't
//! have a standalone negation type so there's ... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/class_base.rs | crates/ty_python_semantic/src/types/class_base.rs | use crate::Db;
use crate::types::class::CodeGeneratorKind;
use crate::types::generics::Specialization;
use crate::types::tuple::TupleType;
use crate::types::{
ApplyTypeMappingVisitor, ClassLiteral, ClassType, DynamicType, KnownClass, KnownInstanceType,
MaterializationKind, MroError, MroIterator, NormalizedVisit... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/call.rs | crates/ty_python_semantic/src/types/call.rs | use super::context::InferContext;
use super::{Signature, Type, TypeContext};
use crate::Db;
use crate::types::call::bind::BindingError;
use crate::types::{MemberLookupPolicy, PropertyInstanceType};
use ruff_python_ast as ast;
mod arguments;
pub(crate) mod bind;
pub(super) use arguments::{Argument, CallArguments};
pub(... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | false |
astral-sh/ruff | https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_python_semantic/src/types/signatures.rs | crates/ty_python_semantic/src/types/signatures.rs | //! _Signatures_ describe the expected parameters and return type of a function or other callable.
//! Overloads and unions add complexity to this simple description.
//!
//! In a call expression, the type of the callable might be a union of several types. The call must
//! be compatible with _all_ of these types, sinc... | rust | MIT | 8464aca795bc3580ca15fcb52b21616939cea9a9 | 2026-01-04T15:31:59.413821Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.