Skip to content

Commit

Permalink
Roll back dep updates
Browse files Browse the repository at this point in the history
Unfortunately we can't have nice things because of the people who want
1.48.0 compatibility.
  • Loading branch information
marshallpierce committed Nov 11, 2023
1 parent c8257a7 commit 2f5d65b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ workflows:
# get a nightly or stable toolchain via rustup instead of a mutable docker tag
toolchain_override: [
'__msrv__', # won't add any other toolchains, just uses what's in the docker image
'1.70.0', # minimum needed to build dev-dependencies
'1.65.0', # minimum needed to build dev-dependencies
'stable',
'beta',
'nightly'
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["base64", "utf8", "encode", "decode", "no_std"]
categories = ["encoding"]
license = "MIT OR Apache-2.0"
edition = "2018"
# dev-dependencies require 1.70, but the main code doesn't
# dev-dependencies require 1.65, but the main code doesn't
# This option was added in 1.56, keep it for when we bump MSRV.
rust-version = "1.48.0"

Expand All @@ -35,11 +35,11 @@ required-features = ["alloc"]
rustdoc-args = ["--generate-link-to-definition"]

[dev-dependencies]
criterion = "0.5"
criterion = "0.4.0"
rand = { version = "0.8.5", features = ["small_rng"] }
clap = { version = "4", features = ["derive"] }
structopt = "0.3.26"
# test fixtures for engine tests
rstest = "0.18.0"
rstest = "0.13.0"
rstest_reuse = "0.6.0"
once_cell = "1"

Expand Down
21 changes: 13 additions & 8 deletions examples/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ use std::process;
use std::str::FromStr;

use base64::{alphabet, engine, read, write};
use clap::{self, Parser};
use structopt::StructOpt;

#[derive(Copy, Clone, Debug, Default, Parser)]
#[derive(Debug, StructOpt)]
enum Alphabet {
#[default]
Standard,
UrlSafe,
}

impl Default for Alphabet {
fn default() -> Self {
Self::Standard
}
}

impl FromStr for Alphabet {
type Err = String;
fn from_str(s: &str) -> Result<Self, String> {
Expand All @@ -26,22 +31,22 @@ impl FromStr for Alphabet {
}

/// Base64 encode or decode FILE (or standard input), to standard output.
#[derive(Debug, Parser)]
#[derive(Debug, StructOpt)]
struct Opt {
/// decode data
#[arg(short, long)]
#[structopt(short = "d", long = "decode")]
decode: bool,
/// The alphabet to choose. Defaults to the standard base64 alphabet.
/// Supported alphabets include "standard" and "urlsafe".
#[arg(short, long)]
#[structopt(long = "alphabet")]
alphabet: Option<Alphabet>,
/// The file to encode/decode.
#[arg(short, long)]
#[structopt(parse(from_os_str))]
file: Option<PathBuf>,
}

fn main() {
let opt = Opt::parse();
let opt = Opt::from_args();
let stdin;
let mut input: Box<dyn Read> = match opt.file {
None => {
Expand Down

0 comments on commit 2f5d65b

Please sign in to comment.