mirror of
https://github.com/Magnus167/msyrs.git
synced 2025-08-20 04:20:00 +00:00
Add from_string method to BDateFreq enum for easier conversion from String
This commit is contained in:
parent
328fb24509
commit
8343e93b46
@ -71,6 +71,10 @@ pub enum BDateFreq {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BDateFreq {
|
impl BDateFreq {
|
||||||
|
pub fn from_string(freq: String) -> Result<Self, Box<dyn Error>> {
|
||||||
|
// use `from_str` to convert the string to a BDateFreq enum
|
||||||
|
Self::from_str(&freq)
|
||||||
|
}
|
||||||
pub fn from_str(freq: &str) -> Result<Self, Box<dyn Error>> {
|
pub fn from_str(freq: &str) -> Result<Self, Box<dyn Error>> {
|
||||||
match freq {
|
match freq {
|
||||||
"D" => Ok(BDateFreq::Daily),
|
"D" => Ok(BDateFreq::Daily),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user