Skip to content

Commit 8890767

Browse files
committed
Just add docs
1 parent 924a99e commit 8890767

File tree

4 files changed

+7
-64
lines changed

4 files changed

+7
-64
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ jobs:
8383
- name: Build
8484
env:
8585
EXT_PHP_RS_TEST: ""
86-
run: cargo build --release --features closure,anyhow,async --all
86+
run: cargo build --release --features closure,anyhow --all
8787
# Test & lint
8888
- name: Test inline examples
89-
run: cargo test --release --all --features closure,anyhow,async
89+
run: cargo test --release --all --features closure,anyhow
9090
- name: Run rustfmt
9191
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
9292
run: cargo fmt --all -- --check

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
55
homepage = "https://github.com/davidcole1340/ext-php-rs"
66
license = "MIT OR Apache-2.0"
77
keywords = ["php", "ffi", "zend"]
8-
version = "0.10.4"
8+
version = "0.10.3"
99
authors = ["David Cole <david.cole1340@gmail.com>"]
1010
edition = "2018"
1111
categories = ["api-bindings"]
@@ -19,12 +19,10 @@ once_cell = "1.17"
1919
anyhow = { version = "1", optional = true }
2020
ext-php-rs-derive = { version = "=0.10.1", path = "./crates/macros" }
2121

22-
[target.'cfg(linux)'.dependencies]
23-
php-tokio = { version = "=0.1.4", optional = true }
24-
2522
[dev-dependencies]
2623
skeptic = "0.13"
2724
reqwest = "0.11.22"
25+
php-tokio = "0.1.4"
2826

2927
[build-dependencies]
3028
anyhow = "1"
@@ -43,7 +41,6 @@ zip = "0.6"
4341
[features]
4442
closure = []
4543
embed = []
46-
async = ["dep:php-tokio"]
4744

4845
[workspace]
4946
members = ["crates/macros", "crates/cli"]

guide/src/macros/impl.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,9 @@ In this example, we're exposing an async Rust HTTP client library called [reqwes
184184

185185
This allows full compatibility with [amphp](https://amphp.org), [PSL](https://github.com/azjezz/psl), [reactphp](https://reactphp.org) and any other async PHP library based on [Revolt](https://revolt.run).
186186

187-
Currently, only Linux is supported by php-tokio.
188-
189-
```rust,no_run
190-
# #![cfg(linux)]
191-
# extern crate ext_php_rs;
192-
# use ext_php_rs::prelude::*;
193-
use php_tokio::EventLoop;
187+
```rust,ignore
188+
use ext_php_rs::prelude::*;
189+
use php_tokio::{php_async_impl, EventLoop};
194190
195191
#[php_class]
196192
struct Client {}
@@ -217,8 +213,6 @@ pub extern "C" fn request_shutdown(_type: i32, _module_number: i32) -> i32 {
217213
pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
218214
module.request_shutdown_function(request_shutdown)
219215
}
220-
221-
# fn main() {}
222216
```
223217

224218
Here's the async PHP code we use to interact with the Rust class we just exposed.

src/lib.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ pub mod prelude {
4848
pub use crate::php_extern;
4949
pub use crate::php_function;
5050
pub use crate::php_impl;
51-
#[cfg(any(docs, feature = "async"))]
52-
pub use crate::php_async_impl;
5351
pub use crate::php_module;
5452
pub use crate::php_print;
5553
pub use crate::php_println;
@@ -392,52 +390,6 @@ pub use ext_php_rs_derive::php_function;
392390
/// ```
393391
pub use ext_php_rs_derive::php_impl;
394392

395-
/// Just like php_impl, annotates a structs `impl` block, declaring that
396-
/// all methods and constants declared inside the `impl` block will be declared
397-
/// as PHP methods and constants.
398-
///
399-
/// This variant of php_impl supports async Rust methods, using [php-tokio](https://github.com/danog/php-tokio)
400-
/// to integrate [tokio](https://tokio.rs) with PHP fibers and the [Revolt](https://revolt.run) event loop,
401-
/// compatible with [Amphp](https://amphp.org), [PSL](https://github.com/azjezz/psl) and any other async PHP library based on Revolt.
402-
///
403-
/// # Example
404-
///
405-
/// ```no_run
406-
/// # #![cfg(linux)]
407-
/// # use ext_php_rs::prelude::*;
408-
/// use php_tokio::EventLoop;
409-
///
410-
/// #[php_class]
411-
/// struct Client {}
412-
///
413-
/// #[php_async_impl]
414-
/// impl Client {
415-
/// pub fn init() -> PhpResult<u64> {
416-
/// EventLoop::init()
417-
/// }
418-
/// pub fn wakeup() -> PhpResult<()> {
419-
/// EventLoop::wakeup()
420-
/// }
421-
/// pub async fn get(url: &str) -> anyhow::Result<String> {
422-
/// Ok(reqwest::get(url).await?.text().await?)
423-
/// }
424-
/// }
425-
///
426-
/// pub extern "C" fn request_shutdown(_type: i32, _module_number: i32) -> i32 {
427-
/// EventLoop::shutdown();
428-
/// 0
429-
/// }
430-
///
431-
/// #[php_module]
432-
/// pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
433-
/// module.request_shutdown_function(request_shutdown)
434-
/// }
435-
///
436-
/// pub fn main() {}
437-
/// ```
438-
#[cfg(any(docs, feature = "async"))]
439-
pub use php_tokio::php_async_impl;
440-
441393
/// Annotates a function that will be used by PHP to retrieve information about
442394
/// the module.
443395
///

0 commit comments

Comments
 (0)