Skip to content

Commit 2728e18

Browse files
committed
no regex dep
1 parent ba576d9 commit 2728e18

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

godot-bindings/src/godot_version.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@
99
// while all the functions included are used only with `custom-api` and `custom-api-json` features.
1010
#![cfg_attr(not(feature = "api-custom"), allow(unused_variables, dead_code))]
1111

12+
use crate::GodotVersion;
13+
14+
#[cfg(feature = "api-custom")]
1215
use std::error::Error;
16+
#[cfg(feature = "api-custom")]
1317
use std::str::FromStr;
1418

19+
#[cfg(feature = "api-custom")]
1520
use regex::{Captures, Regex};
1621

17-
use crate::GodotVersion;
18-
22+
#[cfg(feature = "api-custom")]
1923
pub fn parse_godot_version(version_str: &str) -> Result<GodotVersion, Box<dyn Error>> {
2024
// Format of the string emitted by `godot --version`:
2125
// https://github.com/godot-rust/gdext/issues/118#issuecomment-1465748123
@@ -71,6 +75,7 @@ pub(crate) fn validate_godot_version(godot_version: &GodotVersion) {
7175
}
7276

7377
/// Extracts and parses a named capture group from a regex match.
78+
#[cfg(feature = "api-custom")]
7479
fn cap<T: FromStr>(caps: &Captures, key: &str) -> Result<Option<T>, Box<dyn Error>> {
7580
caps.name(key)
7681
.map(|m| m.as_str().parse())

0 commit comments

Comments
 (0)