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
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/gui_rounding.rs
crates/emath/src/gui_rounding.rs
/// We (sometimes) round sizes and coordinates to an even multiple of this value. /// /// This is only used for rounding _logical UI points_, used for widget coordinates and sizes. /// When rendering, you may want to round to an integer multiple of the physical _pixels_ instead, /// using [`GuiRounding::round_to_pixels...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/lib.rs
crates/emath/src/lib.rs
//! Opinionated 2D math library for building GUIs. //! //! Includes vectors, positions, rectangles etc. //! //! Conventions (unless otherwise specified): //! //! * All angles are in radians //! * X+ is right and Y+ is down. //! * (0,0) is left top. //! * Dimension order is always `x y` //! //! ## Integrating with other...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/range.rs
crates/emath/src/range.rs
use std::ops::{RangeFrom, RangeFull, RangeInclusive, RangeToInclusive}; /// Inclusive range of floats, i.e. `min..=max`, but more ergonomic than [`RangeInclusive`]. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "byt...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/vec2b.rs
crates/emath/src/vec2b.rs
use crate::Vec2; /// Two bools, one for each axis (X and Y). #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Vec2b { pub x: bool, pub y: bool, } impl Vec2b { pub const FALSE: Self = Self { x: false, y: false }; ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/smart_aim.rs
crates/emath/src/smart_aim.rs
//! Find "simple" numbers is some range. Used by sliders. use crate::fast_midpoint; const NUM_DECIMALS: usize = 15; /// Find the "simplest" number in a closed range [min, max], i.e. the one with the fewest decimal digits. /// /// So in the range `[0.83, 1.354]` you will get `1.0`, and for `[0.37, 0.48]` you will get...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/pos2.rs
crates/emath/src/pos2.rs
use std::{ fmt, ops::{Add, AddAssign, MulAssign, Sub, SubAssign}, }; use crate::{Div, Mul, Vec2, lerp}; /// A position on screen. /// /// Normally given in points (logical pixels). /// /// Mathematically this is known as a "point", but the term position was chosen so not to /// conflict with the unit (one poi...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/ts_transform.rs
crates/emath/src/ts_transform.rs
use crate::{Pos2, Rect, Vec2}; /// Linearly transforms positions via a translation, then a scaling. /// /// [`TSTransform`] first scales points with the scaling origin at `0, 0` /// (the top left corner), then translates them. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(ser...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/numeric.rs
crates/emath/src/numeric.rs
/// Implemented for all builtin numeric types pub trait Numeric: Clone + Copy + PartialEq + PartialOrd + 'static { /// Is this an integer type? const INTEGRAL: bool; /// Smallest finite value const MIN: Self; /// Largest finite value const MAX: Self; fn to_f64(self) -> f64; fn from_f...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/rect.rs
crates/emath/src/rect.rs
use std::fmt; use crate::{Div, Mul, NumExt as _, Pos2, Rangef, Rot2, Vec2, fast_midpoint, lerp, pos2, vec2}; use std::ops::{BitOr, BitOrAssign}; /// A rectangular region of space. /// /// Usually a [`Rect`] has a positive (or zero) size, /// and then [`Self::min`] `<=` [`Self::max`]. /// In these cases [`Self::min`] ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/history.rs
crates/emath/src/history.rs
use std::collections::VecDeque; /// This struct tracks recent values of some time series. /// /// It can be used as a smoothing filter for e.g. latency, fps etc, /// or to show a log or graph of recent events. /// /// It has a minimum and maximum length, as well as a maximum storage time. /// * The minimum length is t...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/rect_align.rs
crates/emath/src/rect_align.rs
use crate::{Align2, Pos2, Rect, Vec2}; /// Position a child [`Rect`] relative to a parent [`Rect`]. /// /// The corner from [`RectAlign::child`] on the new rect will be aligned to /// the corner from [`RectAlign::parent`] on the original rect. /// /// There are helper constants for the 12 common menu positions: /// ``...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/align.rs
crates/emath/src/align.rs
//! One- and two-dimensional alignment ([`Align::Center`], [`Align2::LEFT_TOP`] etc). use crate::{Pos2, Rangef, Rect, Vec2, pos2, vec2}; /// left/center/right or top/center/bottom alignment for e.g. anchors and layouts. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(s...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/rot2.rs
crates/emath/src/rot2.rs
use super::Vec2; // {s,c} represents the rotation matrix: // // | c -s | // | s c | // // `vec2(c,s)` represents where the X axis will end up after rotation. // /// Represents a rotation in the 2D plane. /// /// A rotation of 𝞃/4 = 90° rotates the X axis to the Y axis. /// /// Normally a [`Rot2`] is normalized (unit...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/rect_transform.rs
crates/emath/src/rect_transform.rs
use crate::{Pos2, Rect, Vec2, pos2, remap, remap_clamp}; /// Linearly transforms positions from one [`Rect`] to another. /// /// [`RectTransform`] stores the rectangles, and therefore supports clamping and culling. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Dese...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/emath/src/vec2.rs
crates/emath/src/vec2.rs
use std::fmt; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; use crate::Vec2b; /// A vector has a direction and length. /// A [`Vec2`] is often used to represent a size. /// /// emath represents positions using [`crate::Pos2`]. /// /// Normally the units are points (logical pixel...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/external_eventloop_async/src/app.rs
examples/external_eventloop_async/src/app.rs
#![expect(clippy::unwrap_used)] // It's an example use std::{cell::Cell, io, os::fd::AsRawFd as _, rc::Rc, time::Duration}; use tokio::task::LocalSet; use winit::event_loop::{ControlFlow, EventLoop}; use eframe::{EframePumpStatus, UserEvent, egui}; pub fn run() -> io::Result<()> { env_logger::init(); // Log to ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/external_eventloop_async/src/main.rs
examples/external_eventloop_async/src/main.rs
#![expect(rustdoc::missing_crate_level_docs)] // it's an example #[cfg(target_os = "linux")] mod app; #[cfg(target_os = "linux")] fn main() -> std::io::Result<()> { app::run() } // Do not check `app` on unsupported platforms when check "--all-features" is used in CI. #[cfg(not(target_os = "linux"))] fn main() { ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/external_eventloop/src/main.rs
examples/external_eventloop/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs, clippy::unwrap_used)] // it's an example use eframe::{UserEvent, egui}; use std::{cell::Cell, rc::Rc}; use winit::event_loop::{ControlFlow, EventLoop}; fn main()...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_keypad/src/keypad.rs
examples/custom_keypad/src/keypad.rs
use eframe::egui::{self, Button, Ui, Vec2, pos2, vec2}; #[derive(Clone, Copy, Debug, Default, PartialEq)] enum Transition { #[default] None, CloseOnNextFrame, CloseImmediately, } #[derive(Clone, Debug)] struct State { open: bool, closable: bool, close_on_next_frame: bool, start_pos: eg...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_keypad/src/main.rs
examples/custom_keypad/src/main.rs
// #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; mod keypad; use keypad::Keypad; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_window_frame/src/main.rs
examples/custom_window_frame/src/main.rs
//! Show a custom window frame instead of the default OS window chrome decorations. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui::{self, ViewportCommand}; fn main() -> e...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/hello_android/src/lib.rs
examples/hello_android/src/lib.rs
#![doc = include_str!("../README.md")] use eframe::{CreationContext, egui}; #[cfg(target_os = "android")] #[no_mangle] fn android_main(app: winit::platform::android::activity::AndroidApp) { // Log to android output android_logger::init_once( android_logger::Config::default().with_max_level(log::LevelF...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/hello_android/src/main.rs
examples/hello_android/src/main.rs
use hello_android::MyApp; fn main() -> eframe::Result { eframe::run_native( "hello_android", Default::default(), Box::new(|cc| Ok(Box::new(MyApp::new(cc)))), ) }
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/confirm_exit/src/main.rs
examples/confirm_exit/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_font_style/src/main.rs
examples/custom_font_style/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; use egui::{FontFamily, FontId, RichText, TextStyle}; use std::collections::BTreeMap; fn main() -> eframe::Result { env_...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/multiple_viewports/src/main.rs
examples/multiple_viewports/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use std::sync::{ Arc, atomic::{AtomicBool, Ordering}, }; use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/user_attention/src/main.rs
examples/user_attention/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::{CreationContext, NativeOptions, egui}; use egui::{Button, CentralPanel, UserAttentionType}; use std::time::{Duration, SystemTime...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/hello_world_par/src/main.rs
examples/hello_world_par/src/main.rs
//! This example shows that you can use egui in parallel from multiple threads. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(clippy::unwrap_used)] // it's an example use std::sync::mpsc; use std::thread::JoinHandle; use eframe::egui; fn ma...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/serial_windows/src/main.rs
examples/serial_windows/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/keyboard_events/src/main.rs
examples/keyboard_events/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; use egui::{Key, ScrollArea}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_font/src/main.rs
examples/custom_font/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::{ egui, epaint::text::{FontInsert, InsertFontFamily}, }; fn main() -> eframe::Result { env_logger::init(); // Log to ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/hello_world_simple/src/main.rs
examples/hello_world_simple/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_style/src/main.rs
examples/custom_style/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui::{ self, Color32, Stroke, Style, Theme, global_theme_preference_buttons, style::Selection, }; use egui_demo_lib::{View as...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/custom_3d_glow/src/main.rs
examples/custom_3d_glow/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example #![expect(unsafe_code)] #![expect(clippy::undocumented_unsafe_blocks)] use eframe::{egui, egui_glow, glow}; use egui::mutex::Mutex; use std::...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/popups/src/main.rs
examples/popups/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui::{CentralPanel, ComboBox, Popup, PopupCloseBehavior}; fn main() -> Result<(), eframe::Error> { env_logger::init(); // Lo...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/hello_world/src/main.rs
examples/hello_world/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/file_dialog/src/main.rs
examples/file_dialog/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/puffin_profiler/src/main.rs
examples/puffin_profiler/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use std::sync::{ Arc, atomic::{AtomicBool, Ordering}, }; use eframe::egui; fn main() -> eframe::Result { let rust_log = std::env...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/images/src/main.rs
examples/images/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/examples/screenshot/src/main.rs
examples/screenshot/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![expect(rustdoc::missing_crate_level_docs, clippy::unwrap_used)] // it's an example use std::sync::Arc; use eframe::egui::{self, ColorImage}; fn main() -> eframe::Result { env_logger::init(); // Log ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/xtask/src/deny.rs
xtask/src/deny.rs
//! Run `cargo deny` //! //! Also installs the subcommand if it is not already installed. use std::process::Command; use super::DynError; pub fn deny(args: &[&str]) -> Result<(), DynError> { if !args.is_empty() { return Err(format!("Invalid arguments: {args:?}").into()); } install_cargo_deny()?; ...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/xtask/src/utils.rs
xtask/src/utils.rs
#![expect(clippy::unwrap_used)] use std::{ env, io::{self, Write as _}, process::Command, }; use super::DynError; /// Print the command and its arguments as if the user had typed them pub fn print_cmd(cmd: &Command) { print!("{} ", cmd.get_program().to_string_lossy()); for arg in cmd.get_args() {...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
emilk/egui
https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/xtask/src/main.rs
xtask/src/main.rs
//! Helper crate for running scripts within the `egui` repo #![expect(clippy::print_stderr, clippy::print_stdout)] #![allow(clippy::exit)] mod deny; pub(crate) mod utils; type DynError = Box<dyn std::error::Error>; fn main() { if let Err(e) = try_main() { eprintln!("{e}"); std::process::exit(-1)...
rust
Apache-2.0
9e95b9ca50c224077617434707f7bd29bd70938b
2026-01-04T15:36:36.351731Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/build.rs
build.rs
use heck::ToUpperCamelCase; use indexmap::IndexMap; use std::path::Path; use std::{env, fs}; fn main() { cfg_aliases::cfg_aliases! { asdf: { any(feature = "asdf", not(target_os = "windows")) }, macos: { target_os = "macos" }, linux: { target_os = "linux" }, vfox: { any(feature = "vf...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/timings.rs
src/timings.rs
use crate::env; use crate::ui::{style, time}; use std::time::{Duration, Instant}; pub fn start(module: &str) -> impl FnOnce() { let start = Instant::now(); let module = module.to_string(); move || { let diff = start.elapsed(); eprintln!("{}", render(module.as_str(), diff)); } } static ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/shorthands.rs
src/shorthands.rs
use std::collections::HashMap; use std::path::PathBuf; use eyre::Result; use itertools::Itertools; use toml::Table; use crate::config::Settings; use crate::registry::REGISTRY; use crate::{dirs, file}; pub type Shorthands = HashMap<String, Vec<String>>; pub fn get_shorthands(settings: &Settings) -> Shorthands { ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/errors.rs
src/errors.rs
use std::path::PathBuf; use std::process::ExitStatus; use crate::cli::args::BackendArg; use crate::file::display_path; use crate::toolset::{ToolRequest, ToolSource, ToolVersion}; use eyre::Report; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("[{ts}] {tr}: {source:#}")] FailedToResolv...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/wildcard.rs
src/wildcard.rs
use std::str::Chars; pub struct Wildcard { patterns: Vec<String>, } impl Wildcard { pub fn new(patterns: impl IntoIterator<Item = impl Into<String>>) -> Self { Self { patterns: patterns.into_iter().map(Into::into).collect(), } } pub fn match_any(&self, input: &str) -> bool...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/runtime_symlinks.rs
src/runtime_symlinks.rs
use std::path::{Path, PathBuf}; use std::sync::Arc; use crate::backend::Backend; use crate::config::{Alias, Config}; use crate::file::make_symlink_or_file; use crate::plugins::VERSION_REGEX; use crate::semver::split_version_prefix; use crate::{backend, file}; use eyre::Result; use indexmap::IndexMap; use itertools::It...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/fake_asdf.rs
src/fake_asdf.rs
use std::env::{join_paths, split_paths}; use std::fs; use std::os::unix::fs::PermissionsExt; use std::path::PathBuf; use color_eyre::eyre::ErrReport; use indoc::formatdoc; use once_cell::sync::OnceCell; use crate::env::PATH_KEY; use crate::{env, file}; pub fn setup() -> color_eyre::Result<PathBuf> { static SETUP...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/lockfile.rs
src/lockfile.rs
use crate::config::{Config, Settings}; use crate::env; use crate::file; use crate::file::display_path; use crate::path::PathExt; use crate::toolset::{ToolSource, ToolVersion, ToolVersionList, Toolset}; use eyre::{Report, Result, bail}; use itertools::Itertools; use serde_derive::{Deserialize, Serialize}; use std::path:...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
true
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/build_time.rs
src/build_time.rs
use chrono::{DateTime, FixedOffset}; use std::sync::LazyLock as Lazy; pub mod built_info { include!(concat!(env!("OUT_DIR"), "/built.rs")); } pub static BUILD_TIME: Lazy<DateTime<FixedOffset>> = Lazy::new(|| DateTime::parse_from_rfc2822(built_info::BUILT_TIME_UTC).unwrap()); pub static TARGET: &str = built_i...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/test.rs
src/test.rs
use std::env::join_paths; use std::path::PathBuf; use indoc::indoc; use crate::{env, file}; #[ctor::ctor] fn init() { if env::var("RUST_LOG").is_err() { env::set_var("RUST_LOG", "debug") } console::set_colors_enabled(false); console::set_colors_enabled_stderr(false); env::set_var( ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/maplit.rs
src/maplit.rs
#[macro_export] macro_rules! hashmap { (@single $($x:tt)*) => (()); (@count $($rest:expr),*) => (<[()]>::len(&[$(hashmap!(@single $rest)),*])); ($($key:expr => $value:expr,)+) => { hashmap!($($key => $value),+) }; ($($key:expr => $value:expr),*) => { { let _cap = hashmap!(@count $($...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/path.rs
src/path.rs
pub use std::path::*; use crate::dirs; pub trait PathExt { /// replaces $HOME with "~" fn display_user(&self) -> String; fn mount(&self, on: &Path) -> PathBuf; fn is_empty(&self) -> bool; } impl PathExt for Path { fn display_user(&self) -> String { let home = dirs::HOME.to_string_lossy();...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/agecrypt.rs
src/agecrypt.rs
use std::io::{BufReader, Read, Write}; use std::path::{Path, PathBuf}; use age::ssh; use age::{Decryptor, Encryptor, Identity, IdentityFile, Recipient}; use base64::Engine; use eyre::{Result, WrapErr, eyre}; use indexmap::IndexSet; use crate::config::Settings; use crate::config::env_directive::{AgeFormat, EnvDirectiv...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/timeout.rs
src/timeout.rs
use std::sync::mpsc; use std::thread; use std::time::Duration; use crate::ui::time::format_duration; use color_eyre::eyre::{Report, Result}; use std::fmt::{Display, Formatter}; #[derive(Debug, Clone, Copy)] pub struct TimeoutError { pub duration: Duration, } impl Display for TimeoutError { fn fmt(&self, f: &...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/direnv.rs
src/direnv.rs
use std::collections::HashMap; use std::env::{join_paths, split_paths}; use std::fmt::{Display, Formatter}; use std::io::Write; use std::path::{Path, PathBuf}; use crate::env::PATH_KEY; use base64::prelude::*; use eyre::Result; use flate2::Compression; use flate2::write::{ZlibDecoder, ZlibEncoder}; use itertools::Iter...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/netrc.rs
src/netrc.rs
use std::path::PathBuf; use std::sync::LazyLock; use netrc_rs::Netrc; use crate::config::Settings; use crate::dirs; /// Cached parsed netrc file static NETRC: LazyLock<Option<Netrc>> = LazyLock::new(|| { let settings = Settings::get(); if !settings.netrc { return None; } let path = netrc_pat...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/http.rs
src/http.rs
use std::collections::HashMap; use std::io::Write; use std::path::Path; use std::sync::{Arc, Mutex}; use std::time::Duration; use base64::Engine; use base64::prelude::BASE64_STANDARD; use eyre::{Report, Result, bail, ensure}; use regex::Regex; use reqwest::header::{HeaderMap, HeaderValue}; use reqwest::{ClientBuilder,...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/lock_file.rs
src/lock_file.rs
use std::path::{Path, PathBuf}; use eyre::Result; use crate::dirs; use crate::file::{create_dir_all, display_path}; use crate::hash::hash_to_str; pub type OnLockedFn = Box<dyn Fn(&Path)>; pub struct LockFile { path: PathBuf, on_locked: Option<OnLockedFn>, } impl LockFile { pub fn new(path: &Path) -> Se...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/watch_files.rs
src/watch_files.rs
use crate::cmd::cmd; use crate::config::{Config, Settings}; use crate::dirs; use crate::toolset::Toolset; use eyre::Result; use globset::{GlobBuilder, GlobSetBuilder}; use itertools::Itertools; use std::iter::once; use std::path::{Path, PathBuf}; use std::sync::Mutex; use std::{collections::BTreeSet, sync::Arc}; #[der...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/fake_asdf_windows.rs
src/fake_asdf_windows.rs
use std::env::{join_paths, split_paths}; use std::path::PathBuf; use crate::env; use crate::env::PATH_KEY; #[cfg(windows)] pub fn setup() -> color_eyre::Result<PathBuf> { let path = env::MISE_DATA_DIR.join(".fake-asdf"); Ok(path) } pub fn get_path_with_fake_asdf() -> String { let mut path = split_paths(&...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/git.rs
src/git.rs
use std::fmt::Debug; use std::path::{Path, PathBuf}; use duct::Expression; use eyre::{Result, WrapErr, eyre}; use gix::{self}; use once_cell::sync::OnceCell; use xx::file; use crate::cmd::CmdLineRunner; use crate::config::Settings; use crate::file::touch_dir; use crate::ui::progress_report::SingleReport; pub struct ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/logger.rs
src/logger.rs
use crate::config::{Config, Settings}; use eyre::Result; use std::fs::{File, OpenOptions, create_dir_all}; use std::path::Path; use std::sync::Mutex; use std::thread; use std::{io::Write, sync::OnceLock}; use crate::{config, env, ui}; use log::{Level, LevelFilter, Metadata, Record}; #[derive(Debug)] struct Logger { ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/redactions.rs
src/redactions.rs
use indexmap::IndexSet; #[derive(Default, Clone, Debug, serde::Deserialize)] pub struct Redactions(pub IndexSet<String>); impl Redactions { pub fn merge(&mut self, other: Self) { self.0.extend(other.0); } pub fn render(&mut self, tera: &mut tera::Tera, ctx: &tera::Context) -> eyre::Result<()> { ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/migrate.rs
src/migrate.rs
use std::fs; use std::path::Path; use crate::dirs::*; use crate::file; use eyre::Result; pub async fn run() { tokio::join!( task(migrate_trusted_configs), task(migrate_tracked_configs), task(|| remove_deprecated_plugin("node", "rtx-nodejs")), task(|| remove_deprecated_plugin("go", ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/shims.rs
src/shims.rs
use crate::exit; use std::fs; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::{ collections::{BTreeSet, HashSet}, sync::atomic::Ordering, }; use crate::backend::Backend; use crate::cli::exec::Exec; use crate::config::{Config, Settings}; use crate::file::display_path; use crate::lock_file::LockFile...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/platform.rs
src/platform.rs
use crate::config::Settings; use eyre::{Result, bail}; use std::fmt; /// Represents a target platform for lockfile operations #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Platform { pub os: String, pub arch: String, pub qualifier: Option<String>, } impl Platform { /// Parse...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/gitlab.rs
src/gitlab.rs
use eyre::Result; use heck::ToKebabCase; use reqwest::IntoUrl; use reqwest::header::{HeaderMap, HeaderValue}; use serde_derive::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::PathBuf; use std::sync::LazyLock as Lazy; use tokio::sync::{RwLock, RwLockReadGuard}; use xx::regex; use crate::cache::...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/env.rs
src/env.rs
use crate::Result; use crate::env_diff::{EnvDiff, EnvDiffOperation, EnvDiffPatches, EnvMap}; use crate::file::replace_path; use crate::shell::ShellType; use crate::{cli::args::ToolArg, file::display_path}; use eyre::Context; use indexmap::IndexSet; use itertools::Itertools; use log::LevelFilter; pub use std::env::*; us...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/tera.rs
src/tera.rs
use std::collections::HashMap; use std::iter::once; use std::path::{Path, PathBuf}; use heck::{ ToKebabCase, ToLowerCamelCase, ToShoutyKebabCase, ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase, }; use path_absolutize::Absolutize; use rand::prelude::*; use std::sync::LazyLock as Lazy; use tera::{Context, Tera...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/file.rs
src/file.rs
use crate::path::{Path, PathBuf, PathExt}; use std::collections::{BTreeSet, HashMap, HashSet}; use std::fmt::Display; use std::fs; use std::fs::File; use std::io::Write; #[cfg(unix)] use std::os::unix::fs::symlink; #[cfg(unix)] use std::os::unix::prelude::*; use std::sync::Mutex; use std::time::Duration; use bzip2::re...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
true
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/parallel.rs
src/parallel.rs
use crate::Result; use crate::config::Settings; use std::sync::Arc; use tokio::sync::Semaphore; use tokio::task::JoinSet; pub async fn parallel<T, F, Fut, U>(input: Vec<T>, f: F) -> Result<Vec<U>> where T: Send + 'static, U: Send + 'static, F: Fn(T) -> Fut + Send + Copy + 'static, Fut: Future<Output = ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/result.rs
src/result.rs
pub type Result<T> = eyre::Result<T>;
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/rand.rs
src/rand.rs
use rand::Rng; use rand::distr::Alphanumeric; pub fn random_string(length: usize) -> String { rand::rng() .sample_iter(&Alphanumeric) .take(length) .map(char::from) .collect::<String>() }
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/minisign.rs
src/minisign.rs
use crate::*; use minisign_verify::*; use std::iter::Iterator; use std::sync::LazyLock; pub static MISE_PUB_KEY: LazyLock<String> = LazyLock::new(|| { include_str!("../minisign.pub") .to_string() .lines() .last() .unwrap() .to_string() }); pub fn verify(pub_key: &str, data:...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/hooks.rs
src/hooks.rs
use crate::cmd::cmd; use crate::config::{Config, Settings, config_file}; use crate::shell::Shell; use crate::toolset::{ToolVersion, Toolset}; use crate::{dirs, hook_env}; use eyre::{Result, eyre}; use indexmap::IndexSet; use itertools::Itertools; use std::path::{Path, PathBuf}; use std::sync::LazyLock as Lazy; use std:...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/registry.rs
src/registry.rs
use crate::backend::backend_type::BackendType; use crate::cli::args::BackendArg; use crate::config::Settings; use crate::toolset::ToolVersionOptions; use heck::ToShoutySnakeCase; use indexmap::IndexMap; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::env; use std::env::consts::{ARCH, OS}; use std...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/env_diff.rs
src/env_diff.rs
use std::collections::BTreeMap; use std::ffi::OsString; use std::fmt::Debug; use std::io::prelude::*; use std::iter::once; use std::path::{Path, PathBuf}; use base64::prelude::*; use eyre::Result; use flate2::Compression; use flate2::write::{ZlibDecoder, ZlibEncoder}; use indexmap::{IndexMap, IndexSet}; use itertools:...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/dirs.rs
src/dirs.rs
use std::path::{Path, PathBuf}; use std::sync::LazyLock as Lazy; use crate::env; pub static HOME: Lazy<&Path> = Lazy::new(|| &env::HOME); pub static CWD: Lazy<Option<PathBuf>> = Lazy::new(|| env::current_dir().ok()); pub static DATA: Lazy<&Path> = Lazy::new(|| &env::MISE_DATA_DIR); pub static CACHE: Lazy<&Path> = La...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/hash.rs
src/hash.rs
use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::io::{Read, Write}; use std::path::Path; use crate::file; use crate::file::display_path; use crate::ui::progress_report::SingleReport; use blake3::Hasher as Blake3Hasher; use digest::Digest; use eyre::{Result, bail}; use md5::Md5; use sha1::Sha1; us...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/github.rs
src/github.rs
use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::{dirs, duration, env}; use eyre::Result; use heck::ToKebabCase; use reqwest::IntoUrl; use reqwest::header::{HeaderMap, HeaderValue}; use serde_derive::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::PathBuf; use std::sync::LazyLoc...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/hint.rs
src/hint.rs
use crate::config::Settings; use crate::dirs; use std::collections::HashSet; use std::path::PathBuf; use std::sync::LazyLock as Lazy; use std::sync::Mutex; #[macro_export] macro_rules! hint { ($id:expr, $message:expr, $example_cmd:expr) => {{ if $crate::hint::should_display_hint($id) { let _ = ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/semver.rs
src/semver.rs
use versions::{Mess, Versioning}; /// splits a version number into an optional prefix and the remaining version string pub fn split_version_prefix(version: &str) -> (String, String) { version .char_indices() .find_map(|(i, c)| { if c.is_ascii_digit() { if i == 0 { ...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/main.rs
src/main.rs
#![allow(unknown_lints)] #![allow(clippy::literal_string_with_formatting_args)] use std::{ panic, sync::atomic::{AtomicBool, Ordering}, }; use crate::cli::Cli; use crate::cli::version::VERSION; use color_eyre::{Section, SectionExt}; use eyre::Report; use indoc::indoc; use itertools::Itertools; #[cfg(test)] #...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/sops.rs
src/sops.rs
use std::sync::Arc; use crate::config::{Config, Settings}; use crate::env; use crate::file::replace_path; use crate::{dirs, file, result}; use eyre::{WrapErr, eyre}; use rops::cryptography::cipher::AES256GCM; use rops::cryptography::hasher::SHA512; use rops::file::RopsFile; use rops::file::state::EncryptedFile; use to...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/output.rs
src/output.rs
use std::collections::HashSet; use std::sync::LazyLock; use std::sync::Mutex; #[macro_export] macro_rules! prefix_println { ($prefix:expr, $($arg:tt)*) => {{ let msg = format!($($arg)*); println!("{} {}", $prefix, msg); }}; } #[macro_export] macro_rules! prefix_eprintln { ($prefix:expr, $($...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/path_env.rs
src/path_env.rs
use crate::config::Settings; use crate::dirs; use std::env::{join_paths, split_paths}; use std::ffi::OsString; use std::fmt; use std::fmt::{Display, Formatter}; use std::path::PathBuf; use std::str::FromStr; pub struct PathEnv { pre: Vec<PathBuf>, mise: Vec<PathBuf>, post: Vec<PathBuf>, seen_shims: boo...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/cache.rs
src/cache.rs
use std::cmp::min; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::time::Duration; use eyre::Result; use flate2::Compression; use flate2::read::ZlibDecoder; use flate2::write::ZlibEncoder; use itertools::Itertools; use once_cell::sync::OnceCell; use serde::Serialize; use serde::...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/exit.rs
src/exit.rs
use crate::cmd::CmdLineRunner; #[cfg(unix)] use nix::sys::signal::SIGTERM; pub fn exit(code: i32) -> ! { #[cfg(unix)] CmdLineRunner::kill_all(SIGTERM); #[cfg(windows)] CmdLineRunner::kill_all(); debug!("exiting with code: {code}"); std::process::exit(code) }
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/versions_host.rs
src/versions_host.rs
use crate::backend::VersionInfo; use crate::config::Settings; use crate::http; use crate::http::HTTP_FETCH; use crate::plugins::core::CORE_PLUGINS; use crate::registry::REGISTRY; use std::{ collections::{HashMap, HashSet}, sync::{ LazyLock, atomic::{AtomicBool, Ordering}, }, }; use tokio::sy...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/install_context.rs
src/install_context.rs
use std::sync::Arc; use crate::ui::progress_report::SingleReport; use crate::{config::Config, toolset::Toolset}; pub struct InstallContext { pub config: Arc<Config>, pub ts: Arc<Toolset>, pub pr: Box<dyn SingleReport>, pub force: bool, pub dry_run: bool, /// require lockfile URLs to be present...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/cmd.rs
src/cmd.rs
use std::collections::HashSet; use std::ffi::{OsStr, OsString}; use std::fmt::{Debug, Display, Formatter}; use std::io::{BufRead, BufReader, Write}; use std::path::{Path, PathBuf}; use std::process::{Command, ExitStatus, Stdio}; use std::sync::mpsc::channel; use std::sync::{Arc, Mutex, RwLock}; use std::thread; use co...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/uv.rs
src/uv.rs
use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; use crate::config::{Config, Settings}; use crate::ui::multi_progress_report::MultiProgressReport; use crate::{Result, toolset::Toolset}; use crate::{dirs, file}; use std::path::PathBuf; use std::sync::LazyLock as Lazy; use std::{collections::HashMap, sync...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/toml.rs
src/toml.rs
use std::collections::HashSet; #[macro_export] macro_rules! parse_error { ($key:expr, $val:expr, $t:expr) => {{ use eyre::bail; bail!( r#"expected value of {} to be a {}, got: {}"#, $crate::ui::style::eyellow($key), $crate::ui::style::ecyan($t), $cra...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/gpg.rs
src/gpg.rs
use crate::Result; use crate::cmd::CmdLineRunner; use crate::install_context::InstallContext; pub fn add_keys_node(ctx: &InstallContext) -> Result<()> { add_keys(ctx, include_str!("assets/gpg/node.asc")) } pub fn add_keys_swift(ctx: &InstallContext) -> Result<()> { add_keys(ctx, include_str!("assets/gpg/swift...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/hook_env.rs
src/hook_env.rs
use std::io::prelude::*; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::time::{SystemTime, UNIX_EPOCH}; use std::{collections::BTreeSet, sync::Arc}; use base64::prelude::*; use eyre::Result; use flate2::Compression; use flate2::write::{ZlibDecoder, ZlibEncoder}; use indexmap::IndexSet; use itertools::It...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/duration.rs
src/duration.rs
pub use std::time::Duration; use eyre::{Result, bail}; use jiff::{Span, Timestamp, Zoned, civil::date}; pub const HOURLY: Duration = Duration::from_secs(60 * 60); pub const DAILY: Duration = Duration::from_secs(60 * 60 * 24); pub const WEEKLY: Duration = Duration::from_secs(60 * 60 * 24 * 7); pub fn parse_duration(s...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false
jdx/mise
https://github.com/jdx/mise/blob/3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb/src/toolset/toolset_paths.rs
src/toolset/toolset_paths.rs
use std::path::PathBuf; use std::sync::Arc; use dashmap::DashMap; use eyre::Result; use std::sync::LazyLock as Lazy; use crate::config::Config; use crate::config::env_directive::EnvResults; use crate::toolset::Toolset; use crate::uv; // Cache Toolset::list_paths results across identical toolsets within a process. //...
rust
MIT
3e382b34b6bf7d7b1a0efb8fdd8ea10c84498adb
2026-01-04T15:39:11.175160Z
false