update docs

This commit is contained in:
Nikolay Kim 2017-06-15 11:13:58 -07:00
parent 51115e70f2
commit 0679fec859
6 changed files with 22 additions and 22 deletions

View File

@ -36,12 +36,11 @@ script:
# Upload docs
after_success:
- if python -c "import sys; sys.exit(sys.version_info < (3,6))"; then
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" ]]; then
cargo doc --no-deps &&
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html &&
git clone https://github.com/davisp/ghp-import.git &&
./ghp-import/ghp_import.py -n -p -f -m "Documentation upload" -r https://"$GH_TOKEN"@github.com/"$TRAVIS_REPO_SLUG.git" target/doc/pyo3 &&
echo "Uploaded documentation"
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" ]]; then
cargo doc --no-deps &&
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html &&
git clone https://github.com/davisp/ghp-import.git &&
./ghp-import/ghp_import.py -n -p -f -m "Documentation upload" -r https://"$GH_TOKEN"@github.com/"$TRAVIS_REPO_SLUG.git" target/doc/pyo3 &&
echo "Uploaded documentation"
fi

View File

@ -55,7 +55,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
let extra = if let Some(token) = token {
Some(quote! {
impl _pyo3::PyObjectWithToken for #cls {
fn token<'p>(&'p self) -> _pyo3::python::Python<'p> {
fn token<'p>(&'p self) -> _pyo3::Python<'p> {
self.#token.token()
}
}
@ -63,7 +63,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
impl std::fmt::Debug for #cls {
fn fmt(&self, f : &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
let py = _pyo3::PyObjectWithToken::token(self);
let ptr = <#cls as _pyo3::python::ToPyPointer>::as_ptr(self);
let ptr = <#cls as _pyo3::ToPyPointer>::as_ptr(self);
let repr = unsafe {
_pyo3::PyString::downcast_from_ptr(
py, _pyo3::ffi::PyObject_Repr(ptr)).map_err(|_| std::fmt::Error)?
@ -77,7 +77,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
impl std::fmt::Display for #cls {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
let py = _pyo3::PyObjectWithToken::token(self);
let ptr = <#cls as _pyo3::python::ToPyPointer>::as_ptr(self);
let ptr = <#cls as _pyo3::ToPyPointer>::as_ptr(self);
let str_obj = unsafe {
_pyo3::PyString::downcast_from_ptr(
py, _pyo3::ffi::PyObject_Str(ptr)).map_err(|_| std::fmt::Error)?
@ -171,7 +171,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
}
}
impl _pyo3::python::PyDowncastFrom for #cls
impl _pyo3::PyDowncastFrom for #cls
{
fn downcast_from<'a, 'p>(py: Python<'p>, ob: &'a _pyo3::PyObject)
-> Result<&'a #cls, _pyo3::PyDowncastError<'p>>
@ -190,7 +190,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
}
}
}
impl _pyo3::python::PyMutDowncastFrom for #cls
impl _pyo3::PyMutDowncastFrom for #cls
{
fn downcast_mut_from<'a, 'p>(py: Python<'p>, ob: &'a mut _pyo3::PyObject)
-> Result<&'a mut #cls, _pyo3::PyDowncastError<'p>>
@ -228,7 +228,7 @@ fn impl_class(cls: &syn::Ident, base: &syn::Ident,
unsafe{std::mem::transmute(self.as_ptr())}
}
}
impl _pyo3::python::ToPyPointer for #cls {
impl _pyo3::ToPyPointer for #cls {
#[inline]
fn as_ptr(&self) -> *mut ffi::PyObject {
let offset = <#cls as _pyo3::typeob::PyTypeInfo>::offset();

View File

@ -69,7 +69,7 @@ macro_rules! py_exception {
}
}
impl $crate::PyTypeObject for $name {
impl $crate::typeob::PyTypeObject for $name {
#[inline(always)]
fn init_type(py: $crate::Python) {
let _ = $name::type_object(py);

View File

@ -54,8 +54,11 @@
//! }
//! ```
//!
//! Expands to an `extern "C"` function that allows Python to load
//! the rust code as a Python extension module.
//! # Python extension
//!
//! To allow Python to load the rust code as a Python extension
//! module, you need provide initialization function and annotate it with `#[py::modinit(name)]`.
//! `py::modinit` expands to an `extern "C"` function.
//!
//! Macro syntax: `#[py::modinit(name)]`
//!
@ -69,7 +72,7 @@
//!
//! 1. `m`: The module name.
//! 2. function name, name of function visible to Python code.
//! 3. arguments description string, i.e. "param1, param2=None, *, param3='default'"
//! 3. arguments description string, i.e. "param1, param2=None, *, param3=55"
//!
//!
//! # Example
@ -158,7 +161,6 @@ pub use pythonrun::{GILGuard, prepare_freethreaded_python};
pub use conversion::{FromPyObject, RefFromPyObject, ToPyObject, IntoPyObject, IntoPyTuple};
pub mod class;
pub use class::*;
pub use self::typeob::PyTypeObject;
pub mod py {
pub use pyo3cls::*;
@ -180,7 +182,7 @@ macro_rules! cstr(
);
);
pub mod python;
mod python;
mod fmt;
mod err;
mod conversion;

View File

@ -19,7 +19,7 @@ macro_rules! exc_type(
// pyobject_newtype!($name);
impl $crate::PyTypeObject for $name {
impl $crate::typeob::PyTypeObject for $name {
#[inline(always)]
fn init_type(_py: Python) {}

View File

@ -9,7 +9,6 @@ use std::cell::RefCell;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use pyo3::ffi;
use pyo3::python::ToPyPointer;
macro_rules! py_run {