mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
mononoke: implement FromStr for BookmarkName
Summary: implement FromStr for BookmarkName, can use it to handle bookmarks more uniformly with other types in the walker Reviewed By: mitrandir77 Differential Revision: D24725786 fbshipit-source-id: e7eb7ece4a4bdc5dfd91f253f0383829c4ecc73b
This commit is contained in:
parent
99cb9d4f9f
commit
aaa2f671c4
@ -19,6 +19,7 @@ use sql::mysql_async::{
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::ops::{Bound, Range, RangeBounds, RangeFrom, RangeFull};
|
||||
use std::str::FromStr;
|
||||
|
||||
/// This enum represents how fresh you want results to be. MostRecent will go to the master, so you
|
||||
/// normally don't want to issue queries using MostRecent unless you have a very good reason.
|
||||
@ -103,6 +104,13 @@ pub struct BookmarkName {
|
||||
bookmark: AsciiString,
|
||||
}
|
||||
|
||||
impl FromStr for BookmarkName {
|
||||
type Err = Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Ok(BookmarkName::new(s)?)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for BookmarkName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.bookmark)
|
||||
|
Loading…
Reference in New Issue
Block a user