mirror of
https://github.com/AleoHQ/leo.git
synced 2025-01-01 22:36:52 +03:00
Update package declaration
This commit is contained in:
parent
34fa444a06
commit
ee308530f5
@ -23,5 +23,6 @@ pub use errors::*;
|
||||
pub mod imports;
|
||||
pub mod inputs;
|
||||
pub mod outputs;
|
||||
pub mod package;
|
||||
pub mod root;
|
||||
pub mod source;
|
||||
|
27
package/src/package.rs
Normal file
27
package/src/package.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use crate::errors::PackageError;
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Package {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub description: Option<String>,
|
||||
pub license: Option<String>,
|
||||
}
|
||||
|
||||
impl Package {
|
||||
pub fn new(package_name: &str) -> Self {
|
||||
Self {
|
||||
name: package_name.to_owned(),
|
||||
version: "0.1.0".to_owned(),
|
||||
description: None,
|
||||
license: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_package(_package_name: &str) -> Result<(), PackageError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::errors::ManifestError;
|
||||
use crate::{errors::ManifestError, package::Package};
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::{
|
||||
@ -31,14 +31,6 @@ pub struct Remote {
|
||||
pub author: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Package {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub description: Option<String>,
|
||||
pub license: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Manifest {
|
||||
pub package: Package,
|
||||
@ -48,12 +40,7 @@ pub struct Manifest {
|
||||
impl Manifest {
|
||||
pub fn new(package_name: &str) -> Self {
|
||||
Self {
|
||||
package: Package {
|
||||
name: package_name.to_owned(),
|
||||
version: "0.1.0".to_owned(),
|
||||
description: None,
|
||||
license: None,
|
||||
},
|
||||
package: Package::new(package_name),
|
||||
remote: None,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user