Skip to content
Myr

token.rs

This file

Path

src/exec/token.rs

29 lines · 878 bytes · Rust

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 1a16003 point at it.

[ownership][errs] ':' and '' args to --owner result in noop; reject strings with more than one ':'Alexandru Macoveibefore adoption1a16003

lines 1–29why, one step back
1use std::fmt::{self, Display, Formatter};
23/// Designates what should be written to a buffer4///5/// Each `Token` contains either text, or a placeholder variant, which will be used to generate6/// commands after all tokens for a given command template have been collected.7#[derive(Clone, Debug, PartialEq)]8pub enum Token {9 Placeholder,10 Basename,11 Parent,12 NoExt,13 BasenameNoExt,14 Text(String),15}1617impl Display for Token {18 fn fmt(&self, f: &mut Formatter) -> fmt::Result {19 match *self {20 Token::Placeholder => f.write_str("{}")?,21 Token::Basename => f.write_str("{/}")?,22 Token::Parent => f.write_str("{//}")?,23 Token::NoExt => f.write_str("{.}")?,24 Token::BasenameNoExt => f.write_str("{/.}")?,25 Token::Text(ref string) => f.write_str(string)?,26 }27 Ok(())28 }29}