-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FluentResource and FluentBundle::add_resource
- Loading branch information
Zibi Braniecki
committed
Aug 25, 2018
1 parent
14ec3a6
commit c843400
Showing
3 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use fluent_syntax::ast; | ||
use fluent_syntax::parser::parse; | ||
|
||
pub struct FluentResource { | ||
pub ast: ast::Resource, | ||
} | ||
|
||
impl FluentResource { | ||
pub fn from_string(source: &str) -> Self { | ||
let ast = parse(source).unwrap_or_else(|x| x.0); | ||
FluentResource { ast } | ||
} | ||
} |