Expand description
§Meteoritus - API Documentation
Hello, and welcome to the Meteoritus API documentation!
§Usage
Meteoritus is a Fairing
that implements tus protocol on top of Rocket
framework, so in
order to use it you’ll need the following dependencies in Cargo.toml
:
[dependencies]
rocket = "0.5.1"
meteoritus = "0.2.1"
Then attach Meteoritus
to your Rocket
server on launch:
#[macro_use] extern crate rocket;
use rocket::data::ByteUnit;
use meteoritus::Meteoritus;
#[get("/")]
fn hello() -> &'static str {
"Hello, world!"
}
#[launch]
fn rocket() -> _ {
let meteoritus = Meteoritus::new()
.mount_to("/api/files")
.with_temp_path("./tmp/uploads")
.with_max_size(ByteUnit::Gibibyte(1))
.on_creation(|ctx| {
println!("on_creation: {:?}", ctx);
Ok(())
})
.on_created(|ctx| {
println!("on_created: {:?}", ctx);
})
.on_completed(|ctx| {
println!("on_completed: {:?}", ctx);
})
.on_termination(|ctx| {
println!("on_termination: {:?}", ctx);
})
.build();
rocket::build()
.attach(meteoritus)
.mount("/", routes![hello])
}
Structs§
- Built
- Indicates the
FileInfo
Built
state. - Completed
- Indicates the
FileInfo
Completed
state. - Created
- Indicates the
FileInfo
Created
state. - File
Info - A struct representing a file and its metadata during various stages of processing.
- Handler
Context - Represents the context of a file upload handler.
- Metadata
- A struct representing the metadata associated with an uploaded file.
- Meteoritus
- The tus fairing itself.
- Terminated
- Indicates the
FileInfo
Terminated
state.
Enums§
- Metadata
Error - An error type representing errors that can occur while dealing with metadata.
- Meteoritus
Headers - Represents the tus protocol headers.