-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(duvet-core): various fixes needed for integration into main …
…crate (#129) * refactor: improve IETF parser * refactor(duvet-core): various fixes needed for integration into main crate
- Loading branch information
Showing
32 changed files
with
1,725 additions
and
381 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
integration/snapshots/*.snap filter=lfs diff=lfs merge=lfs -text | ||
**/snapshots.tar.gz filter=lfs diff=lfs merge=lfs -text |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ Cargo.lock | |
target | ||
.history | ||
*.snap.new | ||
/duvet/src/specification/ietf/snapshots |
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
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,32 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::{diagnostic::IntoDiagnostic, path::Path, Result}; | ||
use core::cell::RefCell; | ||
use once_cell::sync::Lazy; | ||
use std::sync::Arc; | ||
|
||
static GLOBAL_ARGS: Lazy<Arc<[String]>> = Lazy::new(|| std::env::args().collect()); | ||
static GLOBAL_DIR: Lazy<Result<Path>> = | ||
Lazy::new(|| std::env::current_dir().map(|v| v.into()).into_diagnostic()); | ||
|
||
thread_local! { | ||
static ARGS: RefCell<Arc<[String]>> = RefCell::new(GLOBAL_ARGS.clone()); | ||
static DIR: RefCell<Result<Path>> = RefCell::new(GLOBAL_DIR.clone()); | ||
} | ||
|
||
pub fn args() -> Arc<[String]> { | ||
ARGS.with(|current| current.borrow().clone()) | ||
} | ||
|
||
pub fn set_args(args: Arc<[String]>) { | ||
ARGS.with(|current| *current.borrow_mut() = args); | ||
} | ||
|
||
pub fn current_dir() -> Result<Path> { | ||
DIR.with(|current| current.borrow().clone()) | ||
} | ||
|
||
pub fn set_current_dir(dir: Path) { | ||
DIR.with(|current| *current.borrow_mut() = Ok(dir)); | ||
} |
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
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
Oops, something went wrong.