mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Merge pull request #3105 from youknowone/wchar-t
extract wchar_t definition to rustpython-common
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1793,6 +1793,7 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"hexf-parse",
|
||||
"lexical-core",
|
||||
"libc",
|
||||
"lock_api",
|
||||
"num-bigint",
|
||||
"num-complex",
|
||||
|
||||
@@ -21,3 +21,4 @@ siphasher = "0.3"
|
||||
rand = "0.8"
|
||||
volatile = "0.3"
|
||||
radium = "0.6"
|
||||
libc = "0.2.101"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
use std::ops::{Bound, RangeBounds};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type wchar_t = libc::wchar_t;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type wchar_t = u32;
|
||||
|
||||
pub fn try_get_chars(s: &str, range: impl RangeBounds<usize>) -> Option<&str> {
|
||||
let mut chars = s.chars();
|
||||
let start = match range.start_bound() {
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
pub(crate) use array::make_module;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type wchar_t = libc::wchar_t;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type wchar_t = u32;
|
||||
|
||||
#[pymodule(name = "array")]
|
||||
mod array {
|
||||
use crate::buffer::{BufferOptions, PyBuffer, PyBufferInternal, ResizeGuard};
|
||||
@@ -22,12 +15,12 @@ mod array {
|
||||
PyMappedRwLockReadGuard, PyMappedRwLockWriteGuard, PyRwLock, PyRwLockReadGuard,
|
||||
PyRwLockWriteGuard,
|
||||
};
|
||||
use crate::common::str::wchar_t;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::sliceable::{
|
||||
saturate_index, PySliceableSequence, PySliceableSequenceMut, SequenceIndex,
|
||||
};
|
||||
use crate::slots::{AsBuffer, Comparable, Iterable, PyComparisonOp, PyIter, SlotConstructor};
|
||||
use crate::stdlib::array::wchar_t;
|
||||
use crate::{
|
||||
IdProtocol, IntoPyObject, PyComparisonValue, PyIterable, PyObjectRef, PyRef, PyResult,
|
||||
PyValue, StaticType, TryFromObject, TypeProtocol,
|
||||
|
||||
@@ -24,10 +24,10 @@ pub(crate) mod _struct {
|
||||
pystr::PyStrRef, pytype::PyTypeRef, tuple::PyTupleRef,
|
||||
};
|
||||
use crate::byteslike::{ArgBytesLike, ArgMemoryBuffer};
|
||||
use crate::common::str::wchar_t;
|
||||
use crate::exceptions::PyBaseExceptionRef;
|
||||
use crate::function::Args;
|
||||
use crate::slots::{PyIter, SlotConstructor};
|
||||
use crate::stdlib::array::wchar_t;
|
||||
use crate::utils::Either;
|
||||
use crate::VirtualMachine;
|
||||
use crate::{IntoPyObject, PyObjectRef, PyRef, PyResult, PyValue, StaticType, TryFromObject};
|
||||
|
||||
Reference in New Issue
Block a user