expose more common interfaces

This commit is contained in:
Jeong YunWon
2021-09-22 02:57:37 +09:00
parent b4a6b1e491
commit 7fd2f0b5e7
7 changed files with 9 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ use crate::{
protocol::{BufferInternal, BufferOptions, PyBuffer},
sliceable::{convert_slice, wrap_index, SequenceIndex},
slots::{AsBuffer, Comparable, Hashable, PyComparisonOp, SlotConstructor},
stdlib::pystruct::_struct::FormatSpec,
stdlib::pystruct::FormatSpec,
utils::Either,
IdProtocol, IntoPyObject, PyClassImpl, PyComparisonValue, PyContext, PyObjectRef, PyRef,
PyResult, PyValue, TryFromBorrowedObject, TryFromObject, TypeProtocol, VirtualMachine,

View File

@@ -477,7 +477,7 @@ impl PyStr {
}
#[pymethod(magic)]
pub(crate) fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
pub fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
let in_len = self.byte_len();
let mut out_len = 0usize;
// let mut max = 127;

View File

@@ -60,7 +60,7 @@ mod frozen;
pub mod function;
pub mod import;
pub mod iterator;
mod protocol;
pub mod protocol;
pub mod py_io;
pub mod py_serde;
mod pyobject;
@@ -69,12 +69,12 @@ pub mod readline;
pub mod scope;
mod sequence;
mod signal;
mod sliceable;
pub mod sliceable;
pub mod slots;
pub mod stdlib;
pub mod types;
pub mod utils;
mod version;
pub mod version;
mod vm;
// pub use self::Executor;

View File

@@ -404,7 +404,7 @@ pub(crate) fn wrap_index(p: isize, len: usize) -> Option<usize> {
}
// return pos is in range [0, len] inclusive
pub(crate) fn saturate_index(p: isize, len: usize) -> usize {
pub fn saturate_index(p: isize, len: usize) -> usize {
let mut p = p;
let len = len.to_isize().unwrap();
if p < 0 {

View File

@@ -35,7 +35,7 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
#[allow(unused)]
#[derive(Copy, Clone)]
#[repr(transparent)]
pub(crate) struct Fildes(pub i32);
pub struct Fildes(pub i32);
impl TryFromObject for Fildes {
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {

View File

@@ -2,7 +2,7 @@ use crate::{PyObjectRef, PyResult, VirtualMachine};
use nix;
use std::os::unix::io::RawFd;
pub(crate) fn raw_set_inheritable(fd: RawFd, inheritable: bool) -> nix::Result<()> {
pub fn raw_set_inheritable(fd: RawFd, inheritable: bool) -> nix::Result<()> {
use nix::fcntl;
let flags = fcntl::FdFlag::from_bits_truncate(fcntl::fcntl(fd, fcntl::FcntlArg::F_GETFD)?);
let mut new_flags = flags;

View File

@@ -966,4 +966,4 @@ pub(crate) mod _struct {
}
}
pub(crate) use _struct::make_module;
pub(crate) use _struct::{make_module, FormatSpec};