-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed By: mitrandir77, RajivTS Differential Revision: D50264249 fbshipit-source-id: 56d624c97fcde323e3f7525349052ef3e41b11f7
- Loading branch information
1 parent
e817b10
commit e1ab0bd
Showing
3 changed files
with
53 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# @generated by autocargo | ||
|
||
[package] | ||
name = "justknobs" | ||
version = "0.1.0" | ||
authors = ["Facebook <[email protected]>"] | ||
edition = "2021" | ||
description = "Client for accessing JustKnobs. Noop crate for now" | ||
readme = "../../README.md" | ||
repository = "https://github.com/facebookexperimental/rust-shed/" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[dependencies] | ||
anyhow = "=1.0.72" |
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,38 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under both the MIT license found in the | ||
* LICENSE-MIT file in the root directory of this source tree and the Apache | ||
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory | ||
* of this source tree. | ||
*/ | ||
|
||
//! This crate provides a client for accessing JustKnobs. The version on GitHub | ||
//! is no-op for now. | ||
use anyhow as _; | ||
#[cfg(fbcode_build)] | ||
pub use fb_justknobs::*; | ||
#[cfg(not(fbcode_build))] | ||
pub use stub::*; | ||
|
||
#[cfg(not(fbcode_build))] | ||
mod stub { | ||
use anyhow::Result; | ||
|
||
pub fn eval(_name: &str, _hash_val: Option<&str>, _switch_val: Option<&str>) -> Result<bool> { | ||
Ok(false) | ||
} | ||
|
||
pub fn get(_name: &str, _switch_val: Option<&str>) -> Result<i64> { | ||
Ok(0) | ||
} | ||
|
||
pub fn get_as<T>(_name: &str, _switch_val: Option<&str>) -> Result<T> | ||
where | ||
T: TryFrom<i64>, | ||
<T as TryFrom<i64>>::Error: std::error::Error + Send + Sync + 'static, | ||
{ | ||
Ok(0.try_into()?) | ||
} | ||
} |