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 |
|---|---|---|---|---|---|---|---|---|
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-working-with-hashmaps.rs | activities/src/bin/demo-working-with-hashmaps.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-generics-and-structures.rs | activities/src/bin/demo-generics-and-structures.rs | struct Dimensions {
width: f64,
height: f64,
depth: f64,
}
trait Convey {
fn weight(&self) -> f64;
fn dimensions(&self) -> Dimensions;
}
struct CarPart {
width: f64,
height: f64,
depth: f64,
weight: f64,
part_number: String,
}
impl Default for CarPart {
fn default() -> Sel... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a5.rs | activities/src/bin/a5.rs | // Topic: Looping using the loop statement
//
// Program requirements:
// * Display "1" through "4" in the terminal
//
// Notes:
// * Use a mutable integer variable
// * Use a loop statement
// * Print the variable within the loop statement
// * Use break to exit the loop
fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-abstract-network-request.rs | activities/src/bin/demo-abstract-network-request.rs | #![allow(dead_code)]
use anyhow::Result;
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
struct Person {
name: String,
country: String,
}
#[derive(Debug, Clone, Deserialize)]
struct PersonResponse {
status: String,
code: u16,
total: u64,
data: Vec<Person>,
}
fn get_person(client... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-using-iterators.rs | activities/src/bin/demo-using-iterators.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-enums.rs | activities/src/bin/demo-enums.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a3b.rs | activities/src/bin/a3b.rs | // Topic: Flow control using if..else if..else
//
// Program requirements:
// * Display ">5", "<5", or "=5" based on the value of a variable
// is > 5, < 5, or == 5, respectively
//
// Notes:
// * Use a variable set to any integer value
// * Use an if..else if..else block to determine which message to display
// * Us... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-passing-closures-to-functions.rs | activities/src/bin/demo-passing-closures-to-functions.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-gathering-user-input.rs | activities/src/bin/demo-gathering-user-input.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/m6.rs | activities/src/bin/m6.rs | // Topic: Macro practice
//
// Summary:
// Create a macro that measures how long a function takes to execute.
//
// Requirements:
// * Write a single macro that executes a function:
// * Prior to executing the function, print out "Call: ", followed
// by the function name
// * Measure how long the function ta... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-generating-documentation.rs | activities/src/bin/demo-generating-documentation.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-channels.rs | activities/src/bin/demo-channels.rs | use crossbeam_channel::unbounded;
use std::thread;
enum ThreadMsg {
PrintData(String),
Sum(i64, i64),
Quit,
}
fn main() {
let handle = thread::spawn(move || {});
handle.join();
}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-while-let.rs | activities/src/bin/demo-while-let.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-generics-and-functions.rs | activities/src/bin/demo-generics-and-functions.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-option.rs | activities/src/bin/demo-option.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a17.rs | activities/src/bin/a17.rs | // Topic: Browsing standard library documentation
//
// Requirements:
// * Print a string in lowercase and uppercase
//
// Notes:
// * Utilize standard library functionality to
// transform the string to lowercase and uppercase
// * Use 'rustup doc' in a terminal to open the standard library docs
// * Navigate to the... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a3a.rs | activities/src/bin/a3a.rs | // Topic: Flow control using if..else
//
// Program requirements:
// * Displays a message based on the value of a boolean variable
// * When the variable is set to true, display "hello"
// * When the variable is set to false, display "goodbye"
//
// Notes:
// * Use a variable set to either true or false
// * Use an if.... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a4b.rs | activities/src/bin/a4b.rs | // Topic: Decision making with match
//
// Program requirements:
// * Display "one", "two", "three", or "other" based on whether
// the value of a variable is 1, 2, 3, or some other number,
// respectively
//
// Notes:
// * Use a variable set to any integer
// * Use a match expression to determine which message to ... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-inline-modules.rs | activities/src/bin/demo-inline-modules.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/mc-01.rs | activities/src/bin/mc-01.rs | // Topic: Maintainable code via traits
//
// Summary:
// Recently there was a power outage and all of the messages stored in the message queue
// were lost. You have been tasked with adding functionality to save and load the queue. Review
// the code and then implement the requirements as detailed below.
//
// Re... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-const.rs | activities/src/bin/demo-const.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-numeric-types.rs | activities/src/bin/demo-numeric-types.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a30.rs | activities/src/bin/a30.rs | // Topic: Generics & Structures
//
// Requirements:
// * Create a Vehicle structure that is generic over traits Body and Color
// * Create structures for vehicle bodies and vehicle colors and implement the
// Body and Color traits for these structures
// * Implement a 'new' function for Vehicle that allows it to have... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a21.rs | activities/src/bin/a21.rs | // Topic: Map combinator
//
// Requirements:
// * Given a user name, create and print out a User struct if the user exists
//
// Notes:
// * Use the existing find_user function to locate a user
// * Use the map function to create the User
// * Print out the User struct if found, or a "not found" message if not
#[deriv... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-basic-closures.rs | activities/src/bin/demo-basic-closures.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a36.rs | activities/src/bin/a36.rs | // Topic: Arrays & Slices
//
// Requirements:
// * Print pairs of numbers and their sums as they are streamed from a data source
// * If only one number is received, then print "Unpaired value: V",
// where V is the value
//
// Notes:
// * A simulated data stream is already configured in the code
// * See the stdlib ... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-deriving-functionality.rs | activities/src/bin/demo-deriving-functionality.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a16.rs | activities/src/bin/a16.rs | // Topic: Option
//
// Requirements:
// * Print out the details of a student's locker assignment
// * Lockers use numbers and are optional for students
//
// Notes:
// * Use a struct containing the student's name and locker assignment
// * The locker assignment should use an Option<i32>
fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a26.rs | activities/src/bin/a26.rs | // Topic: External crates
//
// Requirements:
// * Display the current date and time
//
// Notes:
// * Use the `chrono` crate to work with time
// * (OPTIONAL) Read the documentation section `Formatting and Parsing`
// for examples on how to create custom time formats
fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a18b.rs | activities/src/bin/a18b.rs | // Topic: Result & the question mark operator
//
// Summary:
// This small program simulates unlocking a door using digital keycards
// backed by a database. Many errors can occur when working with a database,
// making the question mark operator the perfect thing to use to keep
// the code managable.
//
// Req... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-implementing-functionality.rs | activities/src/bin/demo-implementing-functionality.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-ownership.rs | activities/src/bin/demo-ownership.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a10.rs | activities/src/bin/a10.rs | // Topic: Working with expressions
//
// Requirements:
// * Print "it's big" if a variable is > 100
// * Print "it's small" if a variable is <= 100
//
// Notes:
// * Use a boolean variable set to the result of
// an if..else expression to store whether the value
// is > 100 or <= 100
// * Use a function to print th... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a7.rs | activities/src/bin/a7.rs | // Topic: Working with an enum
//
// Program requirements:
// * Prints the name of a color to the terminal
//
// Notes:
// * Use an enum with color names as variants
// * Use a function to print the color name
// * The function must use the enum as a parameter
// * Use a match expression to determine which color
// n... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/m5.rs | activities/src/bin/m5.rs | // Topic: Macro practice
//
// Summary:
// Create a macro that can be used to generate new test cases for
// the function provided.
//
// Requirements:
// * Write a macro to generate tests for `sample_fn`
// * Create at least 6 test cases using the macro
// * Test the minimum and maximum values for each match arm... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-map-combinator.rs | activities/src/bin/demo-map-combinator.rs | fn maybe_num() -> Option<i32> {
Some(1)
}
fn maybe_word() -> Option<String> {
None
}
fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a34.rs | activities/src/bin/a34.rs | // Topic: Typestates
//
// Summary:
// An airline wants to reduce the amount of lost luggage by
// ensuring luggage is properly tracked.
//
// Requirements:
// * Implement a luggage tracking system using the typestate pattern
// * Each piece of luggage has a tracking id
// * Luggage goes through multiple states at ... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-new-type-pattern.rs | activities/src/bin/demo-new-type-pattern.rs | fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/demo-implementing-intoiterator.rs | activities/src/bin/demo-implementing-intoiterator.rs | use std::collections::HashMap;
#[derive(Debug, Hash, Eq, PartialEq)]
enum Fruit {
Apple,
Banana,
Orange,
}
struct FruitStand {
fruit: HashMap<Fruit, u32>,
}
fn main() {
let mut fruit = HashMap::new();
fruit.insert(Fruit::Banana, 5);
fruit.insert(Fruit::Apple, 2);
fruit.insert(Fruit::O... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a39.rs | activities/src/bin/a39.rs | // Topic: Channels
//
// Summary:
// Using the existing code, create a program that simulates an internet-of-things
// remote control light bulb. The color of the light can be changed remotely.
// Use threads and channels to communicate what color the light bulb should display.
//
// Requirements:
// * Create a s... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a25.rs | activities/src/bin/a25.rs | // Topic: Traits
//
// Requirements:
// * Calculate the perimeter of a square and triangle:
// * The perimeter of a square is the length of any side*4.
// * The perimeter of a triangle is a+b+c where each variable
// represents the length of a side.
// * Print out the perimeter of the shapes
//
// Notes:
// * U... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a24.rs | activities/src/bin/a24.rs | // Topic: Iterator
//
// Requirements:
// * Triple the value of each item in a vector.
// * Filter the data to only include values > 10.
// * Print out each element using a for loop.
//
// Notes:
// * Use an iterator chain to accomplish the task.
fn main() {
let data = vec![1, 2, 3, 4, 5];
}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a28.rs | activities/src/bin/a28.rs | // Topic: New type pattern
//
// Requirements:
// * Display the selected color of shoes, a shirt, and pants
// * Create and display at least one of each type of clothes and color
//
// Notes:
// * Create a new type for each clothing item that wraps the Color enum
// * Each new type should implement a `new` function
/... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a2.rs | activities/src/bin/a2.rs | // Topic: Basic arithmetic
//
// Program requirements:
// * Displays the result of the sum of two numbers
//
// Notes:
// * Use a function to add two numbers together
// * Use a function to display the result
// * Use the "{:?}" token in the println macro to display the result
fn main() {}
| rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a6.rs | activities/src/bin/a6.rs | // Topic: Looping using the while statement
//
// Program requirements:
// * Counts down from 5 to 1, displays the countdown
// in the terminal, then prints "done!" when complete.
//
// Notes:
// * Use a mutable integer variable
// * Use a while statement
// * Print the variable within the while loop
// * Do not use ... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
jayson-lennon/ztm-rust | https://github.com/jayson-lennon/ztm-rust/blob/cb0ac4768346c7270ba3655b32bef022b4803460/activities/src/bin/a38.rs | activities/src/bin/a38.rs | // Topic: Multithreading
//
// Requirements:
// * Run the provided functions in threads
// * Retrieve the data from the threads to print the message
// "Hello, threads!"
//
// Notes:
// * Use the join function to wait for threads to finish
fn msg_hello() -> &'static str {
use std::time::Duration;
std::thread... | rust | MIT | cb0ac4768346c7270ba3655b32bef022b4803460 | 2026-01-04T20:24:50.396322Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/vsock_proxy/src/lib.rs | vsock_proxy/src/lib.rs | // Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
pub mod dns;
pub mod proxy;
#[derive(Copy, Clone, PartialEq)]
pub enum IpAddrType {
/// Only allows IP4 addresses
IPAddrV4Only,
/// Only allows IP6 addresses
IPAddrV6Only,
/// All... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/vsock_proxy/src/dns.rs | vsock_proxy/src/dns.rs | // Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
use std::net::IpAddr;
use chrono::{DateTime, Duration, Utc};
use hickory_resolver::Resolver;
use idna::domain_to_ascii;
use crate::{IpAddrType, VsockProxyResult};
/// `DnsResolu... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/vsock_proxy/src/main.rs | vsock_proxy/src/main.rs | // Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
/// Simple proxy for translating vsock traffic to TCP traffic
/// Example of usage:
/// vsock-proxy 8000 127.0.0.1 9000
///
use clap::{Arg, ArgAction, Command};
use env_logger::init... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/vsock_proxy/src/proxy.rs | vsock_proxy/src/proxy.rs | // Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
/// Contains code for Proxy, a library used for translating vsock traffic to
/// TCP traffic
use log::{info, warn};
use nix::sys::select::{select, FdSet};
use nix::sys::socket::Sock... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/vsock_proxy/tests/connection_test.rs | vsock_proxy/tests/connection_test.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
use std::io::{Read, Write};
use std::net::TcpListener;
use std::net::{IpAddr, Ipv4Addr};
use std::str;
use std::sync::mpsc;
use std::thread;
use tempfile::NamedTempFile;
use vsock::{Vsoc... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/eif_loader/src/lib.rs | eif_loader/src/lib.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
use libc::c_int;
use nix::poll::poll;
use nix::poll::{PollFd, PollFlags};
use std::io::Read;
use std::io::Write;
use std::os::unix::io::AsRawFd;
use vsock::VsockListener;
/// Timeout of... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/lib.rs | src/lib.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
#![allow(clippy::too_many_arguments)]
//! This crate provides the functionality for the Nitro CLI process.
/// The common module (shared between the CLI and encla... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | true |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/utils.rs | src/utils.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use libc::{c_void, close};
use nix::poll::poll;
use nix::poll::{PollFd, PollFlags};
use nix::sys::socket::{connect, socket};
use nix::sys::socket::{AddressFamily, ... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/main.rs | src/main.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
//! This is the entry point for the Nitro CLI process.
extern crate lazy_static;
use clap::{Arg, Command};
use log::info;
use std::os::unix::net::UnixStream;
u... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc_comm.rs | src/enclave_proc_comm.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use log::{debug, info};
use nix::sys::epoll;
use nix::sys::epoll::{EpollEvent, EpollFlags, EpollOp};
use nix::unistd::*;
use serde::de::DeserializeOwned;
use serde... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/common/commands_parser.rs | src/common/commands_parser.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use clap::ArgMatches;
use libc::VMADDR_CID_HOST;
#[cfg(test)]
use libc::VMADDR_CID_LOCAL;
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::str::Fro... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | true |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/common/signal_handler.rs | src/common/signal_handler.rs | // Copyright 2020-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use log::warn;
use nix::sys::signal::{SigSet, Signal};
use nix::sys::signal::{SIGHUP, SIGINT, SIGQUIT, SIGTERM};
use std::os::unix::io::RawFd;
use std::thread... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/common/logger.rs | src/common/logger.rs | // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use chrono::offset::{Local, Utc};
use chrono::DateTime;
use flexi_logger::writers::LogWriter;
use flexi_logger::{DeferredNow, Record};
use nix::unistd::Uid;
use st... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/common/document_errors.rs | src/common/document_errors.rs | use lazy_static::lazy_static;
use std::collections::HashMap;
use crate::common::{NitroCliErrorEnum, NitroCliFailure};
lazy_static! {
/// Structure mapping enum Errors to a specific error code.
pub static ref ERROR_CODES: HashMap<NitroCliErrorEnum, &'static str> =
[
(NitroCliErrorEnum::Uns... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | true |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/common/json_output.rs | src/common/json_output.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
#![allow(clippy::too_many_arguments)]
use aws_nitro_enclaves_image_format::defs::EifIdentityInfo;
use aws_nitro_enclaves_image_format::utils::eif_reader::SignCerti... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/common/mod.rs | src/common/mod.rs | // Copyright 2020-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
/// The module which parses command parameters from command-line arguments.
pub mod commands_parser;
/// The module which provides mappings between NitroCliEr... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/connection.rs | src/enclave_proc/connection.rs | // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use log::{debug, warn};
use nix::sys::epoll::EpollFlags;
use nix::sys::socket::sockopt::PeerCredentials;
use nix::sys::socket::UnixCredentials;
use serde::de::Dese... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/utils.rs | src/enclave_proc/utils.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use std::fs::metadata;
use std::fs::File;
use std::io::Read;
use crate::common::json_output::{EnclaveDescribeInfo, EnclaveRunInfo, MetadataDescribeInfo};
use crat... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/commands.rs | src/enclave_proc/commands.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use aws_nitro_enclaves_image_format::defs::EifIdentityInfo;
use aws_nitro_enclaves_image_format::utils::eif_reader::EifReader;
use aws_nitro_enclaves_image_format:... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/mod.rs | src/enclave_proc/mod.rs | // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
#![allow(clippy::too_many_arguments)]
/// The module which provides top-level enclave commands.
pub mod commands;
/// The module which provides a connection to the... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/resource_manager.rs | src/enclave_proc/resource_manager.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
#![allow(unknown_lints)]
#![allow(deref_nullptr)]
use aws_nitro_enclaves_image_format::defs::EifIdentityInfo;
use driver_bindings::*;
use eif_loader::{enclave_read... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | true |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/cpu_info.rs | src/enclave_proc/cpu_info.rs | // Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use std::collections::BTreeSet;
use std::fs::File;
use std::io::{BufRead, BufReader};
use crate::common::commands_parser::RunEnclavesArgs;
use crate::common:... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/socket.rs | src/enclave_proc/socket.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use inotify::{EventMask, Inotify, WatchMask};
use log::{debug, warn};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync:... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/src/enclave_proc/connection_listener.rs | src/enclave_proc/connection_listener.rs | // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use log::{debug, info, warn};
use nix::sys::epoll::{self, EpollEvent, EpollFlags, EpollOp};
use std::fs::set_permissions;
use std::fs::Permissions;
use std::io;
#... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/tests/tests.rs | tests/tests.rs | // Copyright 2019-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
#[allow(unused_imports)]
#[cfg(test)]
mod tests {
use nitro_cli::common::commands_parser::{
BuildEnclavesArgs, RunEnclavesArgs, SignEifArgs, TerminateEnclavesArgs,
}... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | true |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/tests/test_nitro_cli_args.rs | tests/test_nitro_cli_args.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
#[cfg(test)]
mod test_nitro_cli_args {
use clap::{Arg, Command};
use nitro_cli::create_app;
#[test]
fn terminate_enclave_enclave_id_arg_is_required() {
let app =... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/tests/test_dev_driver.rs | tests/test_dev_driver.rs | // Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(warnings)]
use libc::{VMADDR_CID_HOST, VMADDR_CID_LOCAL};
use std::fs::File;
use std::os::unix::io::{AsRawFd, RawFd};
use std::process::Command;
use driver_bindings::bindings::ne_enclave_star... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/samples/command_executer/src/protocol_helpers.rs | samples/command_executer/src/protocol_helpers.rs | use byteorder::{ByteOrder, LittleEndian};
use nix::sys::socket::MsgFlags;
use nix::sys::socket::{recv, send};
use std::convert::TryInto;
use std::os::unix::io::RawFd;
pub fn send_u64(fd: RawFd, val: u64) -> Result<(), String> {
let mut buf = [0u8; 9];
LittleEndian::write_u64(&mut buf, val);
send_loop(fd, &... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/samples/command_executer/src/lib.rs | samples/command_executer/src/lib.rs | pub mod command_parser;
pub mod protocol_helpers;
pub mod utils;
use command_parser::{CommandOutput, FileArgs, ListenArgs, RunArgs};
use protocol_helpers::{recv_loop, recv_u64, send_loop, send_u64};
use nix::sys::socket::listen as listen_vsock;
use nix::sys::socket::{accept, bind, connect, shutdown, socket};
use nix:... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/samples/command_executer/src/command_parser.rs | samples/command_executer/src/command_parser.rs | use serde::{Deserialize, Serialize};
use std::process::Output;
use clap::ArgMatches;
#[derive(Debug, Clone)]
pub struct ListenArgs {
pub port: u32,
}
impl ListenArgs {
pub fn new_with(args: &ArgMatches) -> Result<Self, String> {
Ok(ListenArgs {
port: parse_port(args)?,
})
}
}
... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/samples/command_executer/src/utils.rs | samples/command_executer/src/utils.rs | use log::error;
pub trait ExitGracefully<T, E> {
fn ok_or_exit(self, message: &str) -> T;
}
impl<T, E: std::fmt::Debug> ExitGracefully<T, E> for Result<T, E> {
fn ok_or_exit(self, message: &str) -> T {
match self {
Ok(val) => val,
Err(err) => {
error!("{:?}: {}"... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/samples/command_executer/src/main.rs | samples/command_executer/src/main.rs | use clap::{Arg, ArgAction, Command};
use command_executer::command_parser::{FileArgs, ListenArgs, RunArgs};
use command_executer::create_app;
use command_executer::{listen, recv_file, run, send_file};
fn main() {
let app = create_app!();
let args = app.get_matches();
match args.subcommand() {
Som... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/enclave_build/src/lib.rs | enclave_build/src/lib.rs | // Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![allow(clippy::too_many_arguments)]
use std::fs::File;
use std::path::Path;
use std::process::Command;
mod docker;
mod utils;
mod yaml_generator;
use aws_nitro_enclaves_image_format::defs::{EifBui... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/enclave_build/src/docker.rs | enclave_build/src/docker.rs | // Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use crate::docker::DockerError::CredentialsError;
use crate::utils::handle_stream_output;
use base64::{engine::general_purpose, Engine as _};
use bollard::auth::DockerCredentials;
use bollard::image::... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/enclave_build/src/utils.rs | enclave_build/src/utils.rs | // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use bollard::errors::Error;
use bollard::secret::{BuildInfo, CreateImageInfo};
use futures::stream::StreamExt;
use futures::Stream;
use log::{error, info};
pub trait StreamItem {
fn error(&self) -> Op... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/enclave_build/src/yaml_generator.rs | enclave_build/src/yaml_generator.rs | // Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use serde::{Deserialize, Serialize};
use std::io::Write;
use tempfile::NamedTempFile;
#[derive(Debug, Serialize, Deserialize)]
struct BootstrapRamfsTemplate {
files: (DirTemplate, FileTemplate, F... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/enclave_build/src/main.rs | enclave_build/src/main.rs | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use clap::{Arg, ArgAction, Command};
use std::fs::OpenOptions;
use aws_nitro_enclaves_image_format::generate_build_info;
use enclave_build::Docker2Eif;
fn main() {
let matches = Command::new("Docker2... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/driver-bindings/src/bindings.rs | driver-bindings/src/bindings.rs | /* automatically generated by rust-bindgen 0.62.0 */
pub const NE_ERR_VCPU_ALREADY_USED: u32 = 256;
pub const NE_ERR_VCPU_NOT_IN_CPU_POOL: u32 = 257;
pub const NE_ERR_VCPU_INVALID_CPU_CORE: u32 = 258;
pub const NE_ERR_INVALID_MEM_REGION_SIZE: u32 = 259;
pub const NE_ERR_INVALID_MEM_REGION_ADDR: u32 = 260;
pub const NE... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
aws/aws-nitro-enclaves-cli | https://github.com/aws/aws-nitro-enclaves-cli/blob/9fa1c9dd7071a310e3dc2414705ac65a4905ee7e/driver-bindings/src/lib.rs | driver-bindings/src/lib.rs | // Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//! Rust FFI bindings to Linux Nitro Enclaves driver, generated using
//! [bindgen](https://crates.io/crates/bindgen).
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
pub mod bindings;
pub use se... | rust | Apache-2.0 | 9fa1c9dd7071a310e3dc2414705ac65a4905ee7e | 2026-01-04T20:09:48.102940Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/assembler.rs | src/assembler.rs | use crate::{evm::*, types::*};
// Assemble disassembled bytecode
pub fn assemble(bytecode: &Bytecode) -> String {
let mut byte_string: String = String::from("0x");
for byte in bytecode {
byte_string.push_str(String::from(byte.opcode).as_str());
if !byte.pushdata.is_none() {
byte_st... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/evm.rs | src/evm.rs | use std::fmt;
use strum_macros::EnumString;
pub const PUSH_OPS: [Opcode; 33] = [
Opcode::Push0,
Opcode::Push1,
Opcode::Push2,
Opcode::Push3,
Opcode::Push4,
Opcode::Push5,
Opcode::Push6,
Opcode::Push7,
Opcode::Push8,
Opcode::Push9,
Opcode::Push10,
Opcode::Push11,
Opco... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/checks.rs | src/checks.rs | use crate::{evm::*, types::*};
// Check if bytecode contains jumps
pub fn contains_jumps(bytecode: &Bytecode) -> bool {
bytecode.iter().any(|byte| {
(byte.opcode == Opcode::Jump) || (byte.opcode == Opcode::Jumpi)
})
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_contains_jumps()... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/types.rs | src/types.rs | use crate::evm::Opcode;
pub type PushData = String;
#[derive(Debug, PartialEq, Clone)]
pub struct ByteData {
pub code_index: usize,
pub opcode: Opcode,
pub pushdata: Option<PushData>
}
pub type Bytecode = Vec<ByteData>; | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/utils.rs | src/utils.rs | use crate::evm::*;
use std::{path::Path, process::Command};
#[derive(Debug, Clone, strum::EnumString)]
#[strum(ascii_case_insensitive)]
pub enum Source {
Raw,
Huff,
}
pub fn compile_huff(path: &str) -> Result<String, String> {
if !Path::new(path).exists() {
return Err(format!("File not found: {}",... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/disassembler.rs | src/disassembler.rs | use crate::{evm::*, types::*, utils::*};
// Output disassembled bytecode string
pub fn output(bytecode: &Bytecode) -> String {
let mut output: String = String::from("");
for byte in bytecode {
if byte.pushdata.is_none() {
output.push_str(format!("\n{} {}", byte.code_index, byte.opcode.op_st... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/main.rs | src/main.rs | use colored::Colorize;
use std::iter;
use clap::Parser;
use crate::{
assembler::*,
checks::contains_jumps,
disassembler::*,
peephole::*,
types::*,
utils::{Source, compile_huff},
};
mod assembler;
mod checks;
mod disassembler;
mod evm;
mod peephole;
mod rules;
mod types;
mod utils;
#[derive(Pa... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/rules.rs | src/rules.rs | use crate::{evm::*, types::*, utils::*};
// Check rules against provided peephole
pub fn check_rules(peephole: &mut Bytecode) -> Bytecode {
// Individual op checks
for i in 0..2 {
let mut byte: ByteData = peephole[i].clone();
// Reducable push size
for j in 1..32 {
... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
kadenzipfel/bytepeep | https://github.com/kadenzipfel/bytepeep/blob/f5ff2a69129155a7818e735dbe62f58eeb277731/src/peephole.rs | src/peephole.rs | use crate::{evm::*, rules::*, types::*};
// Optimize bytecode by creating peepholes and running rule checks
pub fn optimize(bytecode: &Bytecode) -> Bytecode {
let mut i: usize = 0;
let mut code_index: usize = 0;
let mut optimized_bytecode: Bytecode = vec![];
while i < bytecode.len() {
let mut ... | rust | Apache-2.0 | f5ff2a69129155a7818e735dbe62f58eeb277731 | 2026-01-04T20:25:00.748536Z | false |
rbspy/read-process-memory | https://github.com/rbspy/read-process-memory/blob/a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac/src/lib.rs | src/lib.rs | //! Read memory from another process' address space.
//!
//! This crate provides a trait—[`CopyAddress`](trait.CopyAddress.html),
//! and a helper function—[`copy_address`](fn.copy_address.html) that
//! allow reading memory from another process.
//!
//! Note: you may not always have permission to read memory from anot... | rust | MIT | a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac | 2026-01-04T20:25:01.440670Z | false |
rbspy/read-process-memory | https://github.com/rbspy/read-process-memory/blob/a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac/src/bin/test.rs | src/bin/test.rs | // This test program is used in the tests in src/lib.rs.
use std::env;
use std::io::{self, Read};
fn main() {
let size = env::args()
.nth(1)
.and_then(|a| a.parse::<usize>().ok())
.unwrap_or(32);
let data = if size <= u8::max_value() as usize {
(0..size as u8).collect::<Vec<u8>>... | rust | MIT | a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac | 2026-01-04T20:25:01.440670Z | false |
rbspy/read-process-memory | https://github.com/rbspy/read-process-memory/blob/a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac/examples/read-process-bytes.rs | examples/read-process-bytes.rs | extern crate libc;
extern crate read_process_memory;
use read_process_memory::*;
use std::convert::TryInto;
use std::env;
fn bytes_to_hex(bytes: &[u8]) -> String {
let hex_bytes: Vec<String> = bytes.iter().map(|b| format!("{:02x}", b)).collect();
hex_bytes.join("")
}
fn main() {
let pid = env::args().nth... | rust | MIT | a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac | 2026-01-04T20:25:01.440670Z | false |
rbspy/read-process-memory | https://github.com/rbspy/read-process-memory/blob/a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac/examples/read-self.rs | examples/read-self.rs | /// Read bytes from the current process.
use read_process_memory::*;
use std::convert::TryInto;
fn main() {
let data = vec![17u8, 23u8, 45u8, 0u8];
let pid = unsafe { libc::getpid() } as Pid;
let addr = data.as_ptr() as usize;
let handle: ProcessHandle = pid.try_into().unwrap();
copy_address(addr, ... | rust | MIT | a116fd5679a7aeee4b2b4d0843ef68c8b82e2fac | 2026-01-04T20:25:01.440670Z | false |
Zeenobit/moonshine_save | https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/src/lib.rs | src/lib.rs | #![doc = include_str!("../README.md")]
#![warn(missing_docs)]
use std::marker::PhantomData;
use bevy_ecs::prelude::*;
use moonshine_util::Static;
/// Types, traits, and functions related to loading.
pub mod load;
/// Types, traits, and functions related to saving.
pub mod save;
/// Common elements for saving/loadi... | rust | MIT | ca1fdf24a52164d56a38d74598ce975e0bf1ff42 | 2026-01-04T20:25:00.832058Z | false |
Zeenobit/moonshine_save | https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/src/save.rs | src/save.rs | use std::any::TypeId;
use std::io::{self, Write};
use std::marker::PhantomData;
use std::path::PathBuf;
use bevy_ecs::entity::EntityHashSet;
use bevy_ecs::prelude::*;
use bevy_ecs::query::QueryFilter;
use bevy_log::prelude::*;
use bevy_scene::{ron, DynamicScene, DynamicSceneBuilder, SceneFilter};
use moonshine_util::... | rust | MIT | ca1fdf24a52164d56a38d74598ce975e0bf1ff42 | 2026-01-04T20:25:00.832058Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.