pub struct Registry {
pub(crate) host: String,
pub(crate) token: Option<String>,
pub(crate) handle: Easy,
pub(crate) auth_required: bool,
}
Fields§
§host: String
The base URL for issuing API requests.
token: Option<String>
Optional authorization token. If None, commands requiring authorization will fail.
handle: Easy
Curl handle for issuing requests.
auth_required: bool
Whether to include the authorization token with all requests.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn new_handle(
host: String,
token: Option<String>,
handle: Easy,
auth_required: bool,
) -> Registry
pub fn new_handle( host: String, token: Option<String>, handle: Easy, auth_required: bool, ) -> Registry
Creates a new Registry
.
§Example
use curl::easy::Easy;
use crates_io::Registry;
let mut handle = Easy::new();
// If connecting to crates.io, a user-agent is required.
handle.useragent("my_crawler (example.com/info)");
let mut reg = Registry::new_handle(String::from("https://crates.io"), None, handle, true);
pub fn set_token(&mut self, token: Option<String>)
pub(crate) fn token(&self) -> Result<&str>
pub fn host(&self) -> &str
pub fn host_is_crates_io(&self) -> bool
pub fn add_owners(&mut self, krate: &str, owners: &[&str]) -> Result<String>
pub fn remove_owners(&mut self, krate: &str, owners: &[&str]) -> Result<()>
pub fn list_owners(&mut self, krate: &str) -> Result<Vec<User>>
pub fn publish(&mut self, krate: &NewCrate, tarball: &File) -> Result<Warnings>
pub fn search(&mut self, query: &str, limit: u32) -> Result<(Vec<Crate>, u32)>
pub fn yank(&mut self, krate: &str, version: &str) -> Result<()>
pub fn unyank(&mut self, krate: &str, version: &str) -> Result<()>
pub(crate) fn put(&mut self, path: &str, b: &[u8]) -> Result<String>
pub(crate) fn get(&mut self, path: &str) -> Result<String>
pub(crate) fn delete(&mut self, path: &str, b: Option<&[u8]>) -> Result<String>
pub(crate) fn req( &mut self, path: &str, body: Option<&[u8]>, authorized: Auth, ) -> Result<String>
pub(crate) fn handle( &mut self, read: &mut dyn FnMut(&mut [u8]) -> usize, ) -> Result<String>
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl !Sync for Registry
impl Unpin for Registry
impl !UnwindSafe for Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes