-
String
:
A growable, heap-allocated string type. It's the most common string type used in Rust and is often used when you need to modify the string's contents. -
&str
:
A string slice, which is a reference to a portion of a string, usually a part of aString
or a string literal. It is an immutable reference to a sequence of UTF-8 encoded bytes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
INSTALL_DIR="$HOME/.dotnet" | |
VERSION_PREFIX="" | |
RUNTIMES=() | |
DRY_RUN=false | |
AUTO_YES=false | |
LIST_MODE=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "rustyfeed" | |
version = "0.1.0" | |
edition = "2024" | |
[dependencies] | |
clap = { version = "4.5.32", features = ["derive"] } | |
reqwest = "0.12.15" | |
serde = { version = "1.0.219", features = ["derive"] } | |
syndication = "0.5.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# About: | |
# Dockerfile for SML# a Standard ML family programming language | |
# See: | |
# https://github.com/smlsharp/smlsharp | |
# Usage: | |
# docker build -t smlsharp . | |
# docker run --rm -it smlsharp:latest rlwrap smlsharp | |
# | |
FROM --platform=linux/x86-64 debian:buster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod cli { | |
use std::io::Write; | |
#[derive(Debug, thiserror::Error)] | |
pub enum CliError { | |
#[error("failed to flush stdout: {0}")] | |
Flush(std::io::Error), | |
#[error("failed read line: {0}")] | |
ReadLine(std::io::Error), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// A module for emitting [`Event`] defined in this module by internally looping events and handling crossterm events | |
use crossterm::event::{Event as CrosstermEvent, EventStream as CrosstermEventStream}; | |
use pin_project::pin_project; | |
use std::time::Duration; | |
use tokio::sync::mpsc; | |
use tokio_stream::{Stream, StreamExt}; | |
#[derive(Debug, Clone, Copy)] | |
pub enum Event { | |
Tick, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use clap::{Parser, ValueEnum}; | |
use glob::{glob, GlobError, PatternError}; | |
use std::path::PathBuf; | |
use thiserror::Error; | |
#[derive(Debug, clap::Parser)] | |
struct Args { | |
#[arg(help = "Target files path")] | |
files: Vec<String>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"progressbar_example/progress" | |
"time" | |
) | |
func main() { | |
count := 10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use eyre::{Result, WrapErr}; | |
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufWriter}; | |
use tokio::process::Command; // Use eyre for error handling | |
pub async fn run_command<W: tokio::io::AsyncWrite + Send + 'static + Unpin>( | |
cmd: &str, | |
args: &[&str], | |
stdout_writer: W, | |
stderr_writer: W, | |
) -> Result<()> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use eyre::OptionExt; | |
use reqwest::Url; | |
use select::{ | |
document::Document, | |
predicate::{Class, Name, Predicate}, | |
}; | |
use serde::{Deserialize, Serialize}; | |
#[derive(Debug, Serialize, Deserialize, Default)] | |
pub struct DiffInfo { |
NewerOlder