You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::path::Path[Buf] - Path would probably only work on paths without spaces in them. You could also quote them, but that would only work for PathBuf. One other edge case is handling path separators for the current platform (for parsing PATH). There's enough variance that it might be simpler to just require the use of an abstract scanner. - decided that there isn't enough benefit here over just using a regular string scanner of some description. Once Rustc confuses lifetimes of different unrelated variables of type &'static str when implementing a trait for &'a str rust-lang/rust#26448 gets fixed, they should all just work for paths, anyway.
Abstract scanners:
Various forstd::time::Duration - Duration doesn't have a very nice Debug representation (although it could be parsed). Would probably be nicer to just have scanners for various units of time (Seconds, Days, etc.). ISO 8601 is a bit ugly, but covers all the usual bases. If there's demand, shorthand f64 -> Duration scanners can be added.
HorizontalSpace - match any horizontal spaces: \x20, \t, etc., but not newlines or vertical tabs.
Newline - match any of \r, \r\n, \n.
Runtime scanners:
until(impl Pattern) - slice until a given std::str::pattern::Pattern matches.
pat(impl Pattern) - use str::starts_with. - impossible given current Pattern design.
The text was updated successfully, but these errors were encountered:
Ideas for more scanners.
Self scanners:
- decided that there isn't enough benefit here over just using a regular string scanner of some description. Once Rustc confuses lifetimes of different unrelated variables of type &'static str when implementing a trait for &'a str rust-lang/rust#26448 gets fixed, they should all just work for paths, anyway.std::path::Path[Buf]
-Path
would probably only work on paths without spaces in them. You could also quote them, but that would only work forPathBuf
. One other edge case is handling path separators for the current platform (for parsingPATH
). There's enough variance that it might be simpler to just require the use of an abstract scanner.Abstract scanners:
Various forstd::time::Duration
-Duration
doesn't have a very niceDebug
representation (although it could be parsed).Would probably be nicer to just have scanners for various units of time (ISO 8601 is a bit ugly, but covers all the usual bases. If there's demand, shorthandSeconds
,Days
, etc.).f64 -> Duration
scanners can be added.HorizontalSpace
- match any horizontal spaces:\x20
,\t
, etc., but not newlines or vertical tabs.Newline
- match any of\r
,\r\n
,\n
.Runtime scanners:
until(impl Pattern)
- slice until a givenstd::str::pattern::Pattern
matches.- impossible given currentpat(impl Pattern)
- usestr::starts_with
.Pattern
design.The text was updated successfully, but these errors were encountered: