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 |
|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/src/sync/reusable_box.rs | tokio-util/src/sync/reusable_box.rs | use std::alloc::Layout;
use std::fmt;
use std::future::{self, Future};
use std::mem::{self, ManuallyDrop};
use std::pin::Pin;
use std::ptr;
use std::task::{Context, Poll};
/// A reusable `Pin<Box<dyn Future<Output = T> + Send + 'a>>`.
///
/// This type lets you replace the future stored in the box without
/// realloca... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/src/sync/tests/loom_cancellation_token.rs | tokio-util/src/sync/tests/loom_cancellation_token.rs | use crate::sync::CancellationToken;
use loom::{future::block_on, thread};
use tokio_test::assert_ok;
#[test]
fn cancel_token() {
loom::model(|| {
let token = CancellationToken::new();
let token1 = token.clone();
let th1 = thread::spawn(move || {
block_on(async {
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/src/sync/tests/mod.rs | tokio-util/src/sync/tests/mod.rs | #[cfg(loom)]
mod loom_cancellation_token;
| rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/src/sync/cancellation_token/guard_ref.rs | tokio-util/src/sync/cancellation_token/guard_ref.rs | use crate::sync::CancellationToken;
/// A wrapper for cancellation token which automatically cancels
/// it on drop. It is created using [`drop_guard_ref`] method on the [`CancellationToken`].
///
/// This is a borrowed version of [`DropGuard`].
///
/// [`drop_guard_ref`]: CancellationToken::drop_guard_ref
/// [`DropG... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/src/sync/cancellation_token/guard.rs | tokio-util/src/sync/cancellation_token/guard.rs | use crate::sync::CancellationToken;
/// A wrapper for cancellation token which automatically cancels
/// it on drop. It is created using [`drop_guard`] method on the [`CancellationToken`].
///
/// [`drop_guard`]: CancellationToken::drop_guard
#[derive(Debug)]
pub struct DropGuard {
pub(super) inner: Option<Cancell... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/src/sync/cancellation_token/tree_node.rs | tokio-util/src/sync/cancellation_token/tree_node.rs | //! This mod provides the logic for the inner tree structure of the `CancellationToken`.
//!
//! `CancellationTokens` are only light handles with references to [`TreeNode`].
//! All the logic is actually implemented in the [`TreeNode`].
//!
//! A [`TreeNode`] is part of the cancellation tree and may have one parent and... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/_require_full.rs | tokio-util/tests/_require_full.rs | #![cfg(not(feature = "full"))]
compile_error!("run tokio-util tests with `--features full`");
| rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/framed_stream.rs | tokio-util/tests/framed_stream.rs | use futures_core::stream::Stream;
use std::{io, pin::Pin};
use tokio_test::{assert_ready, io::Builder, task};
use tokio_util::codec::{BytesCodec, FramedRead};
macro_rules! pin {
($id:ident) => {
Pin::new(&mut $id)
};
}
macro_rules! assert_read {
($e:expr, $n:expr) => {{
let val = assert_re... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/framed_write.rs | tokio-util/tests/framed_write.rs | #![warn(rust_2018_idioms)]
use tokio::io::AsyncWrite;
use tokio_test::{assert_ready, task};
use tokio_util::codec::{Encoder, FramedWrite};
use bytes::{BufMut, BytesMut};
use futures_sink::Sink;
use std::collections::VecDeque;
use std::io::{self, Write};
use std::pin::Pin;
use std::task::Poll::{Pending, Ready};
use st... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/mpsc.rs | tokio-util/tests/mpsc.rs | use futures::sink::SinkExt;
use std::future::poll_fn;
use tokio::sync::mpsc::channel;
use tokio_test::task::spawn;
use tokio_test::{
assert_ok, assert_pending, assert_ready, assert_ready_eq, assert_ready_err, assert_ready_ok,
};
use tokio_util::sync::PollSender;
#[tokio::test]
async fn simple() {
let (send, mu... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/io_stream_reader.rs | tokio-util/tests/io_stream_reader.rs | #![warn(rust_2018_idioms)]
use bytes::Bytes;
use tokio::io::AsyncReadExt;
use tokio_stream::iter;
use tokio_util::io::StreamReader;
#[tokio::test]
async fn test_stream_reader() -> std::io::Result<()> {
let stream = iter(vec![
std::io::Result::Ok(Bytes::from_static(&[])),
Ok(Bytes::from_static(&[0,... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/io_reader_stream.rs | tokio-util/tests/io_reader_stream.rs | #![warn(rust_2018_idioms)]
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, ReadBuf};
use tokio_stream::StreamExt;
/// produces at most `remaining` zeros, that returns error.
/// each time it reads at most 31 byte.
struct Reader {
remaining: usize,
}
impl AsyncRead for Reader {
f... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/spawn_pinned.rs | tokio-util/tests/spawn_pinned.rs | #![warn(rust_2018_idioms)]
#![cfg(not(target_os = "wasi"))] // Wasi doesn't support threads
use std::rc::Rc;
use std::sync::Arc;
use tokio::sync::Barrier;
use tokio_util::task;
/// Simple test of running a !Send future via spawn_pinned
#[tokio::test]
async fn can_spawn_not_send_future() {
let pool = task::LocalPo... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/future.rs | tokio-util/tests/future.rs | use std::{
future::{pending, ready, Future},
task::{Context, Poll},
};
use futures_test::task::new_count_waker;
use tokio::pin;
use tokio_test::{assert_pending, assert_ready_eq};
use tokio_util::{future::FutureExt, sync::CancellationToken};
#[derive(Default)]
struct ReadyOnTheSecondPollFuture {
polled: bo... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/task_tracker.rs | tokio-util/tests/task_tracker.rs | #![warn(rust_2018_idioms)]
use futures::future::pending;
#[cfg(tokio_unstable)]
use std::rc::Rc;
use tokio::sync::mpsc;
use tokio::task::LocalSet;
use tokio_test::{assert_pending, assert_ready, task};
use tokio_util::task::TaskTracker;
#[test]
fn open_close() {
let tracker = TaskTracker::new();
assert!(!track... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/length_delimited.rs | tokio-util/tests/length_delimited.rs | #![warn(rust_2018_idioms)]
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_test::task;
use tokio_test::{
assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok,
};
use tokio_util::codec::*;
use bytes::{BufMut, Bytes, BytesMut};
use futures::{pin_mut, Sink, Stream};
use s... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/io_sink_writer.rs | tokio-util/tests/io_sink_writer.rs | #![warn(rust_2018_idioms)]
use bytes::Bytes;
use futures_util::SinkExt;
use std::io::{self, Error, ErrorKind};
use tokio::io::AsyncWriteExt;
use tokio_util::codec::{Encoder, FramedWrite};
use tokio_util::io::{CopyToBytes, SinkWriter};
use tokio_util::sync::PollSender;
#[tokio::test]
async fn test_copied_sink_writer()... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/framed.rs | tokio-util/tests/framed.rs | #![warn(rust_2018_idioms)]
use tokio_stream::StreamExt;
use tokio_test::assert_ok;
use tokio_util::codec::{Decoder, Encoder, Framed, FramedParts};
use bytes::{Buf, BufMut, BytesMut};
use std::io::{self, Read};
use std::pin::Pin;
use std::task::{Context, Poll};
const INITIAL_CAPACITY: usize = 8 * 1024;
/// Encode an... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/panic.rs | tokio-util/tests/panic.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery
#![cfg(panic = "unwind")]
use parking_lot::{const_mutex, Mutex};
use std::error::Error;
use std::panic;
use std::sync::Arc;
use tokio::runtime::Runtime;
use tokio::sync::mpsc::channel;
use tokio::t... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/io_sync_bridge.rs | tokio-util/tests/io_sync_bridge.rs | #![cfg(feature = "io-util")]
#![cfg(not(target_os = "wasi"))] // Wasi doesn't support threads
use std::error::Error;
use std::io::{Cursor, Read, Result as IoResult, Write};
use tokio::io::{AsyncRead, AsyncReadExt};
use tokio_util::io::SyncIoBridge;
async fn test_reader_len(
r: impl AsyncRead + Unpin + Send + 'sta... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/abort_on_drop.rs | tokio-util/tests/abort_on_drop.rs | use tokio::{sync::oneshot, task::yield_now};
use tokio_util::task::AbortOnDropHandle;
#[tokio::test]
async fn aborts_task_on_drop() {
let (mut tx, rx) = oneshot::channel::<bool>();
let handle = tokio::spawn(async move {
let _ = rx.await;
});
let handle = AbortOnDropHandle::new(handle);
drop... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/udp.rs | tokio-util/tests/udp.rs | #![warn(rust_2018_idioms)]
#![cfg(not(target_os = "wasi"))] // Wasi doesn't support UDP
#![cfg(not(miri))] // No `socket` in Miri.
#![cfg(not(loom))] // No udp / UdpFramed in loom
use tokio::net::UdpSocket;
use tokio_stream::StreamExt;
use tokio_util::codec::{Decoder, Encoder, LinesCodec};
use tokio_util::udp::UdpFram... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/codecs.rs | tokio-util/tests/codecs.rs | #![warn(rust_2018_idioms)]
use tokio_util::codec::{AnyDelimiterCodec, BytesCodec, Decoder, Encoder, LinesCodec};
use bytes::{BufMut, Bytes, BytesMut};
#[test]
fn bytes_decoder() {
let mut codec = BytesCodec::new();
let buf = &mut BytesMut::new();
buf.put_slice(b"abc");
assert_eq!("abc", codec.decode(... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/time_delay_queue.rs | tokio-util/tests/time_delay_queue.rs | #![allow(clippy::disallowed_names)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use futures::StreamExt;
use tokio::time::{self, sleep, sleep_until, Duration, Instant};
use tokio_test::{assert_pending, assert_ready, task};
use tokio_util::time::DelayQueue;
macro_rules! poll {
($queue:ident) => {
$... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/framed_read.rs | tokio-util/tests/framed_read.rs | #![warn(rust_2018_idioms)]
use tokio::io::{AsyncRead, ReadBuf};
use tokio_test::assert_ready;
use tokio_test::task;
use tokio_util::codec::{Decoder, FramedRead};
use bytes::{Buf, BytesMut};
use futures::Stream;
use std::collections::VecDeque;
use std::io;
use std::pin::Pin;
use std::task::Poll::{Pending, Ready};
use ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/io_simplex.rs | tokio-util/tests/io_simplex.rs | use futures::pin_mut;
use futures_test::task::noop_context;
use std::io::IoSlice;
use std::task::Poll;
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
use tokio_test::task::spawn;
use tokio_test::{assert_pending, assert_ready};
use tokio_util::io::simplex;
/// Sanity check for single-thre... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/sync_cancellation_token.rs | tokio-util/tests/sync_cancellation_token.rs | #![warn(rust_2018_idioms)]
use tokio::pin;
use tokio::sync::oneshot;
use tokio_util::sync::{CancellationToken, WaitForCancellationFuture};
use core::future::Future;
use core::task::{Context, Poll};
use futures_test::task::new_count_waker;
#[test]
fn cancel_token() {
let (waker, wake_counter) = new_count_waker();... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/io_inspect.rs | tokio-util/tests/io_inspect.rs | use std::{
future::poll_fn,
io::IoSlice,
pin::Pin,
task::{Context, Poll},
};
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
use tokio_util::io::{InspectReader, InspectWriter};
/// An AsyncRead implementation that works byte-by-byte, to catch out callers
/// who don't allo... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/context.rs | tokio-util/tests/context.rs | #![cfg(feature = "rt")]
#![cfg(not(target_os = "wasi"))] // Wasi doesn't support threads
#![warn(rust_2018_idioms)]
use tokio::runtime::Builder;
use tokio::time::*;
use tokio_util::context::RuntimeExt;
#[test]
fn tokio_context_with_another_runtime() {
let rt1 = Builder::new_multi_thread()
.worker_threads(... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/task_join_queue.rs | tokio-util/tests/task_join_queue.rs | #![warn(rust_2018_idioms)]
use tokio::sync::oneshot;
use tokio::task::yield_now;
use tokio::time::Duration;
use tokio_test::{assert_pending, assert_ready, task};
use tokio_util::task::JoinQueue;
#[tokio::test]
async fn test_join_queue_no_spurious_wakeups() {
let (tx, rx) = oneshot::channel::<()>();
let mut jo... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/task_join_map.rs | tokio-util/tests/task_join_map.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "join-map")]
use std::panic::AssertUnwindSafe;
use futures::future::{pending, FutureExt};
use tokio::sync::oneshot;
use tokio::task::LocalSet;
use tokio::time::Duration;
use tokio_util::task::JoinMap;
fn rt() -> tokio::runtime::Runtime {
tokio::runtime::Builder::new_cu... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/poll_semaphore.rs | tokio-util/tests/poll_semaphore.rs | use std::future::Future;
use std::sync::Arc;
use std::task::Poll;
use tokio::sync::{OwnedSemaphorePermit, Semaphore};
use tokio_util::sync::PollSemaphore;
type SemRet = Option<OwnedSemaphorePermit>;
fn semaphore_poll(
sem: &mut PollSemaphore,
) -> tokio_test::task::Spawn<impl Future<Output = SemRet> + '_> {
l... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/reusable_box.rs | tokio-util/tests/reusable_box.rs | use futures::future::FutureExt;
use std::alloc::Layout;
use std::future::Future;
use std::marker::PhantomPinned;
use std::pin::Pin;
use std::rc::Rc;
use std::task::{Context, Poll};
use tokio_util::sync::ReusableBoxFuture;
#[test]
// Clippy false positive; it's useful to be able to test the trait impls for any lifetime... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio-util/tests/compat.rs | tokio-util/tests/compat.rs | #![cfg(feature = "compat")]
#![cfg(not(target_os = "wasi"))] // WASI does not support all fs operations
#![warn(rust_2018_idioms)]
use futures_io::SeekFrom;
use futures_util::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt};
use tempfile::NamedTempFile;
use tokio::fs::OpenOptions;
use tokio_util::compat::TokioAsyncWriteCom... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/attribute.rs | src/attribute.rs | use super::*;
#[allow(clippy::large_enum_variant)]
#[derive(
EnumDiscriminants, PartialEq, Debug, Clone, Serialize, Ord, PartialOrd, Eq, IntoStaticStr,
)]
#[strum(serialize_all = "kebab-case")]
#[serde(rename_all = "kebab-case")]
#[strum_discriminants(name(AttributeDiscriminant))]
#[strum_discriminants(derive(EnumSt... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/recipe_resolver.rs | src/recipe_resolver.rs | use {super::*, CompileErrorKind::*};
pub(crate) struct RecipeResolver<'src: 'run, 'run> {
assignments: &'run Table<'src, Assignment<'src>>,
module_path: &'run str,
modules: &'run Table<'src, Justfile<'src>>,
resolved_recipes: Table<'src, Arc<Recipe<'src>>>,
unresolved_recipes: Table<'src, UnresolvedRecipe<'s... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/config.rs | src/config.rs | use {
super::*,
clap::{
builder::{
styling::{AnsiColor, Effects},
FalseyValueParser, Styles,
},
parser::ValuesRef,
value_parser, Arg, ArgAction, ArgGroup, ArgMatches, Command,
},
};
#[derive(Debug, Default, PartialEq)]
pub(crate) struct Config {
pub(crate) alias_style: AliasStyle,
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | true |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/parameter_kind.rs | src/parameter_kind.rs | use super::*;
/// Parameters can either be…
#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum ParameterKind {
/// …variadic, accepting one or more arguments
Plus,
/// …singular, accepting a single argument
Singular,
/// …variadic, accepting zero or mo... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/dump_format.rs | src/dump_format.rs | use super::*;
#[derive(Debug, Default, PartialEq, Clone, ValueEnum)]
pub(crate) enum DumpFormat {
Json,
#[default]
Just,
}
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/color_display.rs | src/color_display.rs | use super::*;
pub(crate) trait ColorDisplay {
fn color_display(&self, color: Color) -> Wrapper
where
Self: Sized,
{
Wrapper(self, color)
}
fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result;
}
pub(crate) struct Wrapper<'a>(&'a dyn ColorDisplay, Color);
impl Display for Wrapper<'_> {
f... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/recipe.rs | src/recipe.rs | use super::*;
/// Return a `Error::Signal` if the process was terminated by a signal,
/// otherwise return an `Error::UnknownFailure`
fn error_from_signal(recipe: &str, line_number: Option<usize>, exit_status: ExitStatus) -> Error {
match Platform::signal_from_exit_status(exit_status) {
Some(signal) => Error::Si... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/load_dotenv.rs | src/load_dotenv.rs | use super::*;
pub(crate) fn load_dotenv(
config: &Config,
settings: &Settings,
working_directory: &Path,
) -> RunResult<'static, BTreeMap<String, String>> {
let dotenv_filename = config
.dotenv_filename
.as_ref()
.or(settings.dotenv_filename.as_ref());
let dotenv_path = config
.dotenv_path
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/lexer.rs | src/lexer.rs | use {super::*, CompileErrorKind::*, TokenKind::*};
/// Just language lexer
///
/// The lexer proceeds character-by-character, as opposed to using regular
/// expressions to lex tokens or semi-tokens at a time. As a result, it is
/// verbose and straightforward. Just used to have a regex-based lexer, which
/// was slow... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | true |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/variables.rs | src/variables.rs | use super::*;
pub(crate) struct Variables<'expression, 'src> {
stack: Vec<&'expression Expression<'src>>,
}
impl<'expression, 'src> Variables<'expression, 'src> {
pub(crate) fn new(root: &'expression Expression<'src>) -> Self {
Self { stack: vec![root] }
}
}
impl<'src> Iterator for Variables<'_, 'src> {
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/recipe_signature.rs | src/recipe_signature.rs | use super::*;
pub(crate) struct RecipeSignature<'a> {
pub(crate) name: &'a str,
pub(crate) recipe: &'a Recipe<'a>,
}
impl ColorDisplay for RecipeSignature<'_> {
fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result {
write!(f, "{}", self.name)?;
for parameter in &self.recipe.parameters {
w... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/count.rs | src/count.rs | use super::*;
pub struct Count<T: Display>(pub T, pub usize);
impl<T: Display> Display for Count<T> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
if self.1 == 1 {
write!(f, "{}", self.0)
} else {
write!(f, "{}s", self.0)
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/settings.rs | src/settings.rs | use super::*;
pub(crate) const DEFAULT_SHELL: &str = "sh";
pub(crate) const DEFAULT_SHELL_ARGS: &[&str] = &["-cu"];
pub(crate) const WINDOWS_POWERSHELL_SHELL: &str = "powershell.exe";
pub(crate) const WINDOWS_POWERSHELL_ARGS: &[&str] = &["-NoLogo", "-Command"];
#[derive(Debug, PartialEq, Serialize, Default)]
pub(crat... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/ast.rs | src/ast.rs | use super::*;
/// The top-level type produced by the parser. Not all successful parses result
/// in valid justfiles, so additional consistency checks and name resolution
/// are performed by the `Analyzer`, which produces a `Justfile` from an `Ast`.
#[derive(Debug, Clone)]
pub(crate) struct Ast<'src> {
pub(crate) i... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/node.rs | src/node.rs | use super::*;
/// Methods common to all AST nodes. Currently only used in parser unit tests.
pub(crate) trait Node<'src> {
/// Construct an untyped tree of atoms representing this Node. This function,
/// and `Tree` type, are only used in parser unit tests.
fn tree(&self) -> Tree<'src>;
}
impl<'src> Node<'src> ... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/const_error.rs | src/const_error.rs | use super::*;
#[derive(Clone, Copy, Debug)]
pub(crate) enum ConstError<'src> {
Backtick(Token<'src>),
FunctionCall(Name<'src>),
Variable(Name<'src>),
}
impl<'src> ConstError<'src> {
pub(crate) fn context(self) -> Token<'src> {
match self {
Self::Backtick(token) => token,
Self::FunctionCall(nam... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/use_color.rs | src/use_color.rs | use super::*;
#[derive(Copy, Clone, Debug, PartialEq, ValueEnum)]
pub(crate) enum UseColor {
Always,
Auto,
Never,
}
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/string_state.rs | src/string_state.rs | use super::*;
pub(crate) enum StringState {
FormatContinue(StringKind),
FormatStart,
Normal,
}
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/justfile.rs | src/justfile.rs | use {super::*, serde::Serialize};
#[derive(Debug, PartialEq, Serialize)]
pub(crate) struct Justfile<'src> {
pub(crate) aliases: Table<'src, Alias<'src>>,
pub(crate) assignments: Table<'src, Assignment<'src>>,
#[serde(rename = "first", serialize_with = "keyed::serialize_option")]
pub(crate) default: Option<Arc<... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/source.rs | src/source.rs | use super::*;
#[derive(Debug)]
pub(crate) struct Source<'src> {
pub(crate) file_depth: u32,
pub(crate) file_path: Vec<PathBuf>,
pub(crate) import_offsets: Vec<usize>,
pub(crate) namepath: Option<Namepath<'src>>,
pub(crate) path: PathBuf,
pub(crate) working_directory: PathBuf,
}
impl<'src> Source<'src> {
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/invocation.rs | src/invocation.rs | use super::*;
#[derive(Debug, PartialEq)]
pub(crate) struct Invocation<'src, 'run> {
pub(crate) arguments: Vec<Vec<String>>,
pub(crate) recipe: &'run Recipe<'src>,
}
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/delimiter.rs | src/delimiter.rs | use super::*;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum Delimiter {
Brace,
Bracket,
FormatString(StringKind),
Paren,
}
impl Delimiter {
pub(crate) fn open(self) -> char {
match self {
Self::Brace | Self::FormatString(_) => '{',
Self::Bracket => '[',
Self::Paren => '(... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/search_config.rs | src/search_config.rs | use super::*;
/// Controls how `just` will search for the justfile.
#[derive(Debug, Default, PartialEq)]
pub(crate) enum SearchConfig {
/// Recursively search for the justfile upwards from the invocation directory
/// to the root, setting the working directory to the directory in which the
/// justfile is found.... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/lib.rs | src/lib.rs | //! `just` is primarily used as a command-line binary, but does provide a
//! limited public library interface.
//!
//! Please keep in mind that there are no semantic version guarantees for the
//! library interface. It may break or change at any time.
pub(crate) use {
crate::{
alias::Alias,
alias_style::Ali... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/analyzer.rs | src/analyzer.rs | use {super::*, CompileErrorKind::*};
#[derive(Default)]
pub(crate) struct Analyzer<'run, 'src> {
aliases: Table<'src, Alias<'src, Namepath<'src>>>,
assignments: Vec<&'run Binding<'src, Expression<'src>>>,
modules: Table<'src, Justfile<'src>>,
recipes: Vec<&'run Recipe<'src, UnresolvedDependency<'src>>>,
sets... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/platform_interface.rs | src/platform_interface.rs | use super::*;
pub(crate) trait PlatformInterface {
/// translate path from "native" path to path interpreter expects
fn convert_native_path(config: &Config, working_directory: &Path, path: &Path) -> FunctionResult;
/// install handler, may only be called once
fn install_signal_handler<T: Fn(Signal) + Send + '... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/pattern.rs | src/pattern.rs | use super::*;
#[derive(Debug, Clone)]
pub(crate) struct Pattern<'src> {
pub(crate) regex: Regex,
pub(crate) token: Token<'src>,
}
impl<'src> Pattern<'src> {
pub(crate) fn is_match(&self, haystack: &str) -> bool {
self.regex.is_match(haystack)
}
pub(crate) fn new(literal: &StringLiteral<'src>) -> Result... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/assignment_resolver.rs | src/assignment_resolver.rs | use {super::*, CompileErrorKind::*};
pub(crate) struct AssignmentResolver<'src: 'run, 'run> {
assignments: &'run Table<'src, Assignment<'src>>,
evaluated: BTreeSet<&'src str>,
stack: Vec<&'src str>,
}
impl<'src: 'run, 'run> AssignmentResolver<'src, 'run> {
pub(crate) fn resolve_assignments(
assignments: &... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/show_whitespace.rs | src/show_whitespace.rs | use super::*;
/// String wrapper that uses nonblank characters to display spaces and tabs
pub struct ShowWhitespace<'str>(pub &'str str);
impl Display for ShowWhitespace<'_> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
for c in self.0.chars() {
match c {
'\t' => write!(f, "␉")?,
' '... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/dependency.rs | src/dependency.rs | use super::*;
#[derive(Clone, PartialEq, Debug, Serialize)]
pub(crate) struct Dependency<'src> {
#[serde(serialize_with = "flatten_arguments")]
pub(crate) arguments: Vec<Vec<Expression<'src>>>,
#[serde(serialize_with = "keyed::serialize")]
pub(crate) recipe: Arc<Recipe<'src>>,
}
fn flatten_arguments<S: Serial... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/parser.rs | src/parser.rs | use {super::*, TokenKind::*};
/// Just language parser
///
/// The parser is a (hopefully) straightforward recursive descent parser.
///
/// It uses a few tokens of lookahead to disambiguate different constructs.
///
/// The `expect_*` and `presume_`* methods are similar in that they assert the
/// type of unparsed to... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | true |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/signal_handler.rs | src/signal_handler.rs | use super::*;
pub(crate) struct SignalHandler {
caught: Option<Signal>,
children: BTreeMap<i32, Command>,
initialized: bool,
verbosity: Verbosity,
}
impl SignalHandler {
pub(crate) fn install(verbosity: Verbosity) -> RunResult<'static> {
let mut instance = Self::instance();
instance.verbosity = verb... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/string_literal.rs | src/string_literal.rs | use super::*;
#[derive(PartialEq, Debug, Clone, Ord, Eq, PartialOrd)]
pub(crate) struct StringLiteral<'src> {
pub(crate) cooked: String,
pub(crate) expand: bool,
pub(crate) kind: StringKind,
pub(crate) part: Option<FormatStringPart>,
pub(crate) token: Token<'src>,
}
impl Display for StringLiteral<'_> {
fn... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/alias_style.rs | src/alias_style.rs | use super::*;
#[derive(Debug, Default, PartialEq, Clone, ValueEnum)]
pub(crate) enum AliasStyle {
Left,
#[default]
Right,
Separate,
}
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/execution_context.rs | src/execution_context.rs | use super::*;
#[derive(Copy, Clone)]
pub(crate) struct ExecutionContext<'src: 'run, 'run> {
pub(crate) config: &'run Config,
pub(crate) dotenv: &'run BTreeMap<String, String>,
pub(crate) module: &'run Justfile<'src>,
pub(crate) search: &'run Search,
}
impl<'src: 'run, 'run> ExecutionContext<'src, 'run> {
pu... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/fuzzing.rs | src/fuzzing.rs | use super::*;
pub fn compile(text: &str) {
let _ = testing::compile(text);
}
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/list.rs | src/list.rs | use super::*;
pub struct List<T: Display, I: Iterator<Item = T> + Clone> {
conjunction: &'static str,
values: I,
}
impl<T: Display, I: Iterator<Item = T> + Clone> List<T, I> {
pub fn or<II: IntoIterator<Item = T, IntoIter = I>>(values: II) -> Self {
Self {
conjunction: "or",
values: values.into_... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/warning.rs | src/warning.rs | use super::*;
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum Warning {}
impl Warning {
#[allow(clippy::unused_self)]
fn context(&self) -> Option<&Token> {
None
}
}
impl ColorDisplay for Warning {
fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result {
let warning = color.warning();
le... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/fragment.rs | src/fragment.rs | use super::*;
/// A line fragment consisting either of…
#[derive(PartialEq, Debug, Clone)]
pub(crate) enum Fragment<'src> {
/// …an interpolation containing `expression`.
Interpolation { expression: Expression<'src> },
/// …raw text…
Text { token: Token<'src> },
}
impl Serialize for Fragment<'_> {
fn serial... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/token_kind.rs | src/token_kind.rs | use super::*;
#[derive(Debug, PartialEq, Clone, Copy, Ord, PartialOrd, Eq)]
pub(crate) enum TokenKind {
AmpersandAmpersand,
Asterisk,
At,
Backtick,
BangEquals,
BangTilde,
BarBar,
BraceL,
BraceR,
BracketL,
BracketR,
ByteOrderMark,
Colon,
ColonColon,
ColonEquals,
Comma,
Comment,
Deden... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/subcommand.rs | src/subcommand.rs | use {super::*, clap_mangen::Man};
pub const INIT_JUSTFILE: &str = "\
# https://just.systems
default:
echo 'Hello, world!'
";
static BACKTICK_RE: LazyLock<Regex> = LazyLock::new(|| Regex::new("(`.*?`)|(`[^`]*$)").unwrap());
#[derive(PartialEq, Clone, Debug)]
pub(crate) enum Subcommand {
Changelog,
Choose {
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/signal.rs | src/signal.rs | use super::*;
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(i32)]
pub(crate) enum Signal {
Hangup = 1,
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
))]
Info = 29,
Interrupt = 2,
Quit... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/ran.rs | src/ran.rs | use super::*;
#[derive(Default)]
pub(crate) struct Ran(Mutex<BTreeMap<String, BTreeMap<Vec<Vec<String>>, Arc<Mutex<bool>>>>>);
impl Ran {
pub(crate) fn mutex(&self, recipe: &Recipe, arguments: &[Vec<String>]) -> Arc<Mutex<bool>> {
self
.0
.lock()
.unwrap()
.entry(recipe.namepath().into()... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/search_error.rs | src/search_error.rs | use super::*;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub(crate) enum SearchError {
#[snafu(display("Cannot initialize global justfile"))]
GlobalJustfileInit,
#[snafu(display("Global justfile not found"))]
GlobalJustfileNotFound,
#[snafu(display(
"I/O error reading directory `{}`: {}",
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/conditional_operator.rs | src/conditional_operator.rs | use super::*;
/// A conditional expression operator.
#[derive(PartialEq, Debug, Copy, Clone)]
pub(crate) enum ConditionalOperator {
/// `==`
Equality,
/// `!=`
Inequality,
/// `=~`
RegexMatch,
/// `!~`
RegexMismatch,
}
impl Display for ConditionalOperator {
fn fmt(&self, f: &mut Formatter) -> fmt::R... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/platform.rs | src/platform.rs | use super::*;
pub(crate) struct Platform;
#[cfg(unix)]
mod unix;
#[cfg(windows)]
mod windows;
| rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/command_ext.rs | src/command_ext.rs | use super::*;
pub(crate) trait CommandExt {
fn export(
&mut self,
settings: &Settings,
dotenv: &BTreeMap<String, String>,
scope: &Scope,
unexports: &HashSet<String>,
) -> &mut Command;
fn export_scope(&mut self, settings: &Settings, scope: &Scope, unexports: &HashSet<String>);
fn output_g... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/attribute_set.rs | src/attribute_set.rs | use {super::*, std::collections};
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub(crate) struct AttributeSet<'src>(BTreeSet<Attribute<'src>>);
impl<'src> AttributeSet<'src> {
pub(crate) fn len(&self) -> usize {
self.0.len()
}
pub(crate) fn contains(&self, target: AttributeDiscriminant) -> bool {... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/table.rs | src/table.rs | use {super::*, std::collections::btree_map};
#[derive(Debug, PartialEq, Serialize)]
#[serde(transparent)]
pub(crate) struct Table<'key, V: Keyed<'key>> {
map: BTreeMap<&'key str, V>,
}
impl<'key, V: Keyed<'key>> Table<'key, V> {
pub(crate) fn new() -> Self {
Self {
map: BTreeMap::new(),
}
}
pub... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/unindent.rs | src/unindent.rs | #[must_use]
pub fn unindent(text: &str) -> String {
// find line start and end indices
let mut lines = Vec::new();
let mut start = 0;
for (i, c) in text.char_indices() {
if c == '\n' || i == text.len() - c.len_utf8() {
let end = i + c.len_utf8();
lines.push(&text[start..end]);
start = end;... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/compile_error.rs | src/compile_error.rs | use super::*;
#[derive(Debug, PartialEq)]
pub(crate) struct CompileError<'src> {
pub(crate) kind: Box<CompileErrorKind<'src>>,
pub(crate) token: Token<'src>,
}
impl<'src> CompileError<'src> {
pub(crate) fn context(&self) -> Token<'src> {
self.token
}
pub(crate) fn new(token: Token<'src>, kind: CompileE... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/output_error.rs | src/output_error.rs | use super::*;
#[derive(Debug)]
pub(crate) enum OutputError {
/// Non-zero exit code
Code(i32),
/// Interrupted by signal
Interrupted(Signal),
/// IO error
Io(io::Error),
/// Terminated by signal
Signal(i32),
/// Unknown failure
Unknown,
/// Stdout not UTF-8
Utf8(str::Utf8Error),
}
impl OutputE... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/search.rs | src/search.rs | use {super::*, std::path::Component};
const DEFAULT_JUSTFILE_NAME: &str = JUSTFILE_NAMES[0];
pub(crate) const JUSTFILE_NAMES: [&str; 2] = ["justfile", ".justfile"];
const PROJECT_ROOT_CHILDREN: &[&str] = &[".bzr", ".git", ".hg", ".svn", "_darcs"];
#[derive(Debug)]
pub(crate) struct Search {
pub(crate) justfile: Pat... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/tree.rs | src/tree.rs | use {super::*, std::borrow::Cow};
/// Construct a `Tree` from a symbolic expression literal. This macro, and the
/// Tree type, are only used in the Parser unit tests, providing a concise
/// notation for representing the expected results of parsing a given string.
macro_rules! tree {
{ ($($child:tt)*) } => {
$c... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/which.rs | src/which.rs | use super::*;
pub(crate) fn which(context: function::Context, name: &str) -> Result<Option<String>, String> {
let name = Path::new(name);
let candidates = match name.components().count() {
0 => return Err("empty command".into()),
1 => {
// cmd is a regular command
env::split_paths(&env::var_os... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/keyword.rs | src/keyword.rs | use super::*;
#[derive(Debug, Eq, PartialEq, IntoStaticStr, Display, Copy, Clone, EnumString)]
#[strum(serialize_all = "kebab_case")]
pub(crate) enum Keyword {
Alias,
AllowDuplicateRecipes,
AllowDuplicateVariables,
Assert,
DotenvFilename,
DotenvLoad,
DotenvOverride,
DotenvPath,
DotenvRequired,
Else... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/function.rs | src/function.rs | use {
super::*,
heck::{
ToKebabCase, ToLowerCamelCase, ToShoutyKebabCase, ToShoutySnakeCase, ToSnakeCase, ToTitleCase,
ToUpperCamelCase,
},
semver::{Version, VersionReq},
std::collections::HashSet,
Function::*,
};
#[allow(clippy::arbitrary_source_item_ordering)]
pub(crate) enum Function {
Nullary... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/error.rs | src/error.rs | use super::*;
#[derive(Debug)]
pub(crate) enum Error<'src> {
AmbiguousModuleFile {
module: Name<'src>,
found: Vec<PathBuf>,
},
ArgumentPatternMismatch {
argument: String,
parameter: &'src str,
pattern: Box<Pattern<'src>>,
recipe: &'src str,
},
Assert {
message: String,
name: N... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/config_error.rs | src/config_error.rs | use super::*;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)), context(suffix(Context)))]
pub(crate) enum ConfigError {
#[snafu(display("Failed to get current directory: {}", source))]
CurrentDir { source: io::Error },
#[snafu(display(
"Internal config error, this may indicate a bug in just: {message}... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/unstable_feature.rs | src/unstable_feature.rs | use super::*;
#[derive(Copy, Clone, Debug, PartialEq, Ord, Eq, PartialOrd)]
pub(crate) enum UnstableFeature {
FormatSubcommand,
LogicalOperators,
WhichFunction,
}
impl Display for UnstableFeature {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
Self::FormatSubcommand => write!(f, "Th... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/string_kind.rs | src/string_kind.rs | use super::*;
#[derive(Debug, PartialEq, Clone, Copy, Ord, PartialOrd, Eq)]
pub(crate) struct StringKind {
pub(crate) delimiter: StringDelimiter,
pub(crate) indented: bool,
}
impl StringKind {
// Indented values must come before un-indented values, or else
// `Self::from_token_start` will incorrectly return i... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/expression.rs | src/expression.rs | use super::*;
/// An expression. Note that the Just language grammar has both an `expression`
/// production of additions (`a + b`) and values, and a `value` production of
/// all other value types (for example strings, function calls, and
/// parenthetical groups).
///
/// The parser parses both values and expression... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/unresolved_dependency.rs | src/unresolved_dependency.rs | use super::*;
#[derive(PartialEq, Debug, Clone)]
pub(crate) struct UnresolvedDependency<'src> {
pub(crate) arguments: Vec<Expression<'src>>,
pub(crate) recipe: Namepath<'src>,
}
impl Display for UnresolvedDependency<'_> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
if self.arguments.is_empty() {
... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/scope.rs | src/scope.rs | use super::*;
#[derive(Debug)]
pub(crate) struct Scope<'src: 'run, 'run> {
bindings: Table<'src, Binding<'src, String>>,
parent: Option<&'run Self>,
}
impl<'src, 'run> Scope<'src, 'run> {
pub(crate) fn child(&'run self) -> Self {
Self {
parent: Some(self),
bindings: Table::new(),
}
}
pu... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/keyed.rs | src/keyed.rs | use super::*;
pub(crate) trait Keyed<'key> {
fn key(&self) -> &'key str;
}
impl<'key, T: Keyed<'key>> Keyed<'key> for Arc<T> {
fn key(&self) -> &'key str {
self.as_ref().key()
}
}
pub(crate) fn serialize<'src, S, K>(keyed: &K, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
K: Keyed<'src... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
casey/just | https://github.com/casey/just/blob/5732ee083a58c534804d184acbdede11d1bbaac5/src/summary.rs | src/summary.rs | //! Justfile summary creation, for testing purposes only.
//!
//! The contents of this module are not bound by any stability guarantees.
//! Breaking changes may be introduced at any time.
//!
//! The main entry point into this module is the `summary` function, which
//! parses a justfile at a given path and produces a... | rust | CC0-1.0 | 5732ee083a58c534804d184acbdede11d1bbaac5 | 2026-01-04T15:34:07.853244Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.