[−][src]Struct wf2_core::context::Context
The Context
will be given to all recipes when they are
trying to resolve tasks.
Examples
Context has default implementations for every field for maximum flexibility
use wf2_core::context::Context; use wf2_core::recipes::recipe_kinds::RecipeKinds; use wf2_core::php::PHP; let ctx = Context::default(); assert_eq!(ctx.recipe, RecipeKinds::M2); assert_eq!(ctx.php_version, PHP::SevenThree);
You can also create a context directly from a file
let ctx = Context::new_from_file("../fixtures/config_01.yaml")?; assert_eq!(ctx.recipe, RecipeKinds::M2); assert_eq!(ctx.php_version, PHP::SevenThree); assert_eq!(ctx.domains, vec![String::from("acme.m2")]); assert_eq!(ctx.npm_path, PathBuf::from("app/code/frontend/Acme/design"));
Fields
recipe: RecipeKinds
cwd: PathBuf
run_mode: RunMode
name: String
domains: Vec<String>
term: Term
pv: Option<String>
npm_path: PathBuf
php_version: PHP
config_path: Option<PathBuf>
env: Option<Value>
file_prefix: PathBuf
overrides: Option<Value>
debug: bool
uid: u32
gid: u32
scripts: Option<Scripts>
Methods
impl Context
[src]
pub fn new_from_file(path: impl Into<String>) -> Result<Context, FromFileError>
[src]
pub fn new_from_str(yaml_str: &str) -> Result<Context, FromFileError>
[src]
pub fn default_domain(&self) -> String
[src]
pub fn domains(&self) -> String
[src]
pub fn get_context_name(cwd: &PathBuf) -> String
[src]
pub fn merge(&mut self, other: ContextOverrides) -> &mut Self
[src]
pub fn file_path(&self, filename: &str) -> PathBuf
[src]
Trait Implementations
impl Clone for Context
[src]
impl Default for Context
[src]
impl Debug for Context
[src]
impl<'de> Deserialize<'de> for Context
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl FromFile for Context
[src]
fn from_file(input: &str) -> Result<Self, FromFileError> where
Self: Deserialize<'de>,
[src]
Self: Deserialize<'de>,
fn from_yml_file(input: &str) -> Result<Self, FromFileError> where
Self: Deserialize<'de>,
[src]
Self: Deserialize<'de>,
fn from_json_file(input: &str) -> Result<Self, FromFileError> where
Self: Deserialize<'de>,
[src]
Self: Deserialize<'de>,
fn get_file_path(input: &str) -> Result<String, FromFileError>
[src]
fn file_read(input: String) -> Result<String, FromFileError>
[src]
fn from_yaml_string(contents: String) -> Result<Self, FromFileError> where
Self: Deserialize<'de>,
[src]
Self: Deserialize<'de>,
fn from_json_string(contents: String) -> Result<Self, FromFileError> where
Self: Deserialize<'de>,
[src]
Self: Deserialize<'de>,
Auto Trait Implementations
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
impl RefUnwindSafe for Context
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,