-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from azriel91/feature/35/profile-init
- Loading branch information
Showing
70 changed files
with
1,149 additions
and
214 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::borrow::Cow; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
/// Name of the application that is run by end users. | ||
/// | ||
/// This is usually the crate name of the final binary. It needs to be passed in | ||
/// from the executable crate, as it is not possible for Peace to detect it | ||
/// within the library itself. | ||
/// | ||
/// Must begin with a letter or underscore, and contain only letters, numbers, | ||
/// and underscores. | ||
/// | ||
/// # Examples | ||
/// | ||
/// The following are all examples of valid `AppName`s: | ||
/// | ||
/// ```rust | ||
/// # use peace_core::{app_name, AppName}; | ||
/// # | ||
/// let _default = app_name!(); // defaults to calling crate name | ||
/// let _snake = app_name!("snake_case"); | ||
/// let _camel = app_name!("camelCase"); | ||
/// let _pascal = app_name!("PascalCase"); | ||
/// ``` | ||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)] | ||
pub struct AppName(Cow<'static, str>); | ||
|
||
crate::id_newtype!(AppName, AppNameInvalidFmt, app_name); |
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
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,30 @@ | ||
use std::path::PathBuf; | ||
|
||
use peace_core::AppName; | ||
|
||
use crate::paths::PeaceDir; | ||
|
||
/// Directory to store all data produced by the current application's execution. | ||
/// | ||
/// Typically `$workspace_dir/.peace/$app`. | ||
/// | ||
/// This is the directory that contains all information produced and used during | ||
/// a `peace` tool invocation. This directory layer is created to accommodate | ||
/// different `peace` tools being run in the same workspace. | ||
/// | ||
/// # Implementors | ||
/// | ||
/// This type is constructed by the Peace framework when a Workspace's | ||
/// directories are created. | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct PeaceAppDir(PathBuf); | ||
|
||
crate::paths::pathbuf_newtype!(PeaceAppDir); | ||
|
||
impl From<(&PeaceDir, &AppName)> for PeaceAppDir { | ||
fn from((peace_dir, app_name): (&PeaceDir, &AppName)) -> Self { | ||
let path = peace_dir.join(app_name.as_ref()); | ||
|
||
Self(path) | ||
} | ||
} |
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
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,3 @@ | ||
//! Common workspace types for native and web targets. | ||
pub mod ts; |
Oops, something went wrong.