Skip to content

Commit

Permalink
Don't expose private for now
Browse files Browse the repository at this point in the history
May want to do this in a more rustic fashion later on.
  • Loading branch information
alexcrichton authored and bar committed May 13, 2016
1 parent ae8ac07 commit ccf35d3
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/easy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1963,22 +1963,22 @@ impl<'a> Easy<'a> {
enable as c_long)
}

/// Stores a private pointer-sized piece of data.
///
/// This can be retrieved through the `private` function and otherwise
/// libcurl does not tamper with this value. This corresponds to
/// `CURLOPT_PRIVATE` and defaults to 0.
pub fn set_private(&mut self, private: usize) -> Result<(), Error> {
self.setopt_ptr(curl_sys::CURLOPT_PRIVATE, private as *const _)
}
// /// Stores a private pointer-sized piece of data.
// ///
// /// This can be retrieved through the `private` function and otherwise
// /// libcurl does not tamper with this value. This corresponds to
// /// `CURLOPT_PRIVATE` and defaults to 0.
// pub fn set_private(&mut self, private: usize) -> Result<(), Error> {
// self.setopt_ptr(curl_sys::CURLOPT_PRIVATE, private as *const _)
// }

/// Fetches this handle's private pointer-sized piece of data.
///
/// This corresponds to
/// `CURLINFO_PRIVATE` and defaults to 0.
pub fn private(&mut self) -> Result<usize, Error> {
self.getopt_ptr(curl_sys::CURLINFO_PRIVATE).map(|p| p as usize)
}
// /// Fetches this handle's private pointer-sized piece of data.
// ///
// /// This corresponds to
// /// `CURLINFO_PRIVATE` and defaults to 0.
// pub fn private(&mut self) -> Result<usize, Error> {
// self.getopt_ptr(curl_sys::CURLINFO_PRIVATE).map(|p| p as usize)
// }

// =========================================================================
// getters
Expand Down Expand Up @@ -2308,17 +2308,18 @@ impl<'a> Easy<'a> {
default_configure(self);
}

/// Re-initializes this handle to all the default values *and* resets the
/// lifetime associated with this handle.
/// Re-initializes all lifetime-related configuration of this handle and
/// returns a handle with a new associated lifetime.
///
/// The lifetime on this handle is currently used to prevent storing
/// configuration which references data that lives shorter than this handle
/// (e.g. preventing use-after-free). This can make it difficult, however,
/// to reuse an `Easy` handle as the lifetime of callbacks may be limited to
/// a smaller scope.
///
/// This will have the same effect as `reset`, plus the additional effect of
/// returning a handle with a new arbitrary lifetime.
/// This will have the same effect as `reset` for any configuration option
/// that is also bounded by this handle's lifetime, plus the additional
/// effect of returning a handle with a new arbitrary lifetime.
pub fn reset_lifetime<'b>(mut self) -> Easy<'b> {
self.reset();
let new = Easy { handle: self.handle, _marker: marker::PhantomData };
Expand Down

0 comments on commit ccf35d3

Please sign in to comment.