-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2588 from davidhewitt/require-docs
docs: require docs on all public APIs
- Loading branch information
Showing
18 changed files
with
128 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ rustflags = [ | |
"-Delided_lifetimes_in_paths", | ||
"-Dunused_lifetimes", | ||
"-Drust_2021_prelude_collisions" | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/// Runtime inspection of objects exposed to Python. | ||
/// | ||
/// Tracking issue: <https://github.com/PyO3/pyo3/issues/2454>. | ||
//! Runtime inspection of objects exposed to Python. | ||
//! | ||
//! Tracking issue: <https://github.com/PyO3/pyo3/issues/2454>. | ||
pub mod types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//! Data types used to describe runtime Python types. | ||
use std::borrow::Cow; | ||
use std::fmt::{Display, Formatter}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#![allow(missing_docs)] | ||
//! Crate-private implementation of pycell | ||
use std::cell::Cell; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use std::os::raw::{c_int, c_void}; | ||
|
||
use crate::{ffi, AsPyPointer, Python}; | ||
|
||
/// Error returned by a `__traverse__` visitor implementation. | ||
#[repr(transparent)] | ||
pub struct PyTraverseError(pub(crate) c_int); | ||
|
||
/// Object visitor for GC. | ||
#[derive(Clone)] | ||
pub struct PyVisit<'p> { | ||
pub(crate) visit: ffi::visitproc, | ||
pub(crate) arg: *mut c_void, | ||
/// VisitProc contains a Python instance to ensure that | ||
/// 1) it is cannot be moved out of the traverse() call | ||
/// 2) it cannot be sent to other threads | ||
pub(crate) _py: Python<'p>, | ||
} | ||
|
||
impl<'p> PyVisit<'p> { | ||
/// Visit `obj`. | ||
pub fn call<T>(&self, obj: &T) -> Result<(), PyTraverseError> | ||
where | ||
T: AsPyPointer, | ||
{ | ||
let r = unsafe { (self.visit)(obj.as_ptr(), self.arg) }; | ||
if r == 0 { | ||
Ok(()) | ||
} else { | ||
Err(PyTraverseError(r)) | ||
} | ||
} | ||
|
||
/// Creates the PyVisit from the arguments to tp_traverse | ||
#[doc(hidden)] | ||
pub unsafe fn from_raw(visit: ffi::visitproc, arg: *mut c_void, _py: Python<'p>) -> Self { | ||
Self { visit, arg, _py } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters