pub struct Project { /* private fields */ }Source§
Source
Create a new project
path- Path to the project directory (.bnpr)name- Name of the new project
Source
Open an existing project
path- Path to the project directory (.bnpr) or project metadata file (.bnpm)
Source
Check if the project is currently open
Source
Open a closed project
Source
Close a open project
Source
Get the unique id of this project
Source
Get the path of the project
Source
Get the name of the project
Source
Set the name of the project
Source
Get the description of the project
Source
Set the description of the project
Source
Retrieves metadata stored under a key from the project
Source
Stores metadata within the project,
key- Key under which to store the Metadata objectvalue- Object to store
Source
Removes the metadata associated with this key from the project
Source
Recursively create files and folders in the project from a path on disk
path- Path to folder on diskparent- Parent folder in the project that will contain the new contentsdescription- Description for created root folder
Source
Recursively create files and folders in the project from a path on disk
path- Path to folder on diskparent- Parent folder in the project that will contain the new contentsdescription- Description for created root folderprogress-ProgressCallbackthat will be called as theProjectFolderis being created
Source
Recursively create files and folders in the project from a path on disk
parent- Parent folder in the project that will contain the new foldername- Name for the created folderdescription- Description for created folder
Source
Recursively create files and folders in the project from a path on disk
parent- Parent folder in the project that will contain the new foldername- Name for the created folderdescription- Description for created folderid- id unique ID
Source
Get a list of folders in the project
Source
Retrieve a folder in the project by unique folder id
Source
Create a file in the project from a path on disk
path- Path on diskfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created file
Source
Create a file in the project from a path on disk
path- Path on diskfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created fileprogress-ProgressCallbackthat will be called as theProjectFileis being added
Source
Create a file in the project from a path on disk
path- Path on diskfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created fileid- id unique IDcreation_time- Creation time of the file
Source
Create a file in the project from a path on disk
path- Path on diskfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created fileid- id unique IDcreation_time- Creation time of the fileprogress-ProgressCallbackthat will be called as theProjectFileis being created
Source
Create a file in the project
contents- Bytes of the file that will be createdfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created file
Source
Create a file in the project
contents- Bytes of the file that will be createdfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created fileprogress-ProgressCallbackthat will be called as theProjectFileis being created
Source
Create a file in the project
contents- Bytes of the file that will be createdfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created fileid- id unique IDcreation_time- Creation time of the file
Source
Create a file in the project
contents- Bytes of the file that will be createdfolder- Folder to place the created file inname- Name to assign to the created filedescription- Description to assign to the created fileid- id unique IDcreation_time- Creation time of the fileprogress-ProgressCallbackthat will be called as theProjectFileis being created
Source
Get a list of files in the project
Source
Retrieve a file in the project by unique id
Source
Retrieve a file in the project by the path on disk
Source
Retrieve a list of files in the project by the path inside the project.
Because a ProjectFile name is not unique, this returns a list instead of a single ProjectFile.
Source
Retrieve a list of files in the project in a given folder.
Source
Delete a file from the project
Source
A context manager to speed up bulk project operations. Project modifications are synced to disk in chunks, and the project on disk vs in memory may not agree on state if an exception occurs while a bulk operation is happening.
if let Ok(bulk) = project.bulk_operation() {
for file in std::fs::read_dir("/bin/").unwrap().into_iter() {
let file = file.unwrap();
let file_type = file.file_type().unwrap();
if file_type.is_file() && !file_type.is_symlink() {
bulk.create_file_from_path("/bin/", None, &file.file_name().to_string_lossy(), "")
.unwrap();
}
}
}