Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Bump pyo3 and pyo3-log (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvschoor authored Jun 30, 2022
1 parent 26ba820 commit 6b53af5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
bincode = {version="^1.3.1", optional=true}
csv = "1.1.3"
pyo3-log = {version="^0.4.0", optional=true}
pyo3-log = {version="^0.6.0", optional=true}

[dependencies.websocket]
git = "https://github.com/aiarena/rust-websocket"
default-features = false

[dependencies.pyo3]
version = "^0.14"
version = "^0.16"
optional = true
features=["auto-initialize"]

Expand Down
6 changes: 5 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ use pyo3::ToPyObject;
use serde::{Deserialize, Serialize};
use std::thread;
use std::thread::JoinHandle;

pub enum ClientType {
Bot,
Controller,
}

#[cfg_attr(not(feature = "no-pyo3"), derive(Serialize, Deserialize))]
pub struct RustServer {
ip_addr: String,
Expand Down Expand Up @@ -86,6 +88,7 @@ impl RustServer {
})
}
}

#[cfg(not(feature = "no-pyo3"))]
#[pyclass(module = "rust_ac")]
#[pyo3(text_signature = "(ip_addr)")]
Expand All @@ -102,7 +105,7 @@ impl PServer {
match args.len() {
0 => Self { server: None },
1 => {
if let Ok(f) = args.get_item(0).extract::<&str>() {
if let Ok(f) = args.get_item(0).and_then(|x| x.extract::<&str>()) {
Self {
server: Some(RustServer::new(f)),
}
Expand Down Expand Up @@ -144,6 +147,7 @@ impl PServer {
Ok(PyBytes::new(py, &serialize(&self.server).unwrap()).to_object(py))
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 6b53af5

Please sign in to comment.