Skip to content

Commit c224943

Browse files
committed
Cleanup
1 parent 5ee7bc6 commit c224943

File tree

20 files changed

+371
-402
lines changed

20 files changed

+371
-402
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ about: Create a report to help us improve
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

10-
Before reporting an issue please first check the
11-
[troubleshooting guide](https://github.com/twistedfall/opencv-rust/blob/master/README.md#troubleshooting). If
12-
the issue you're encountering is not solved thereby please state the following in your bugreport:
9+
Before reporting an issue, please first check
10+
the [troubleshooting guide](https://github.com/twistedfall/opencv-rust/blob/master/TROUBLESHOOTING.md). If the issue you're
11+
encountering is not solved thereby please state the following in your bugreport:
12+
1313
1. Operating system
1414
2. The way you installed OpenCV: package, official binary distribution, manual compilation, etc.
1515
3. OpenCV version

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ description = "Rust bindings for OpenCV"
44
documentation = "https://docs.rs/opencv"
55
repository = "https://github.com/twistedfall/opencv-rust"
66
readme = "README.md"
7-
keywords = ["opencv", "vision"]
7+
keywords = ["opencv", "vision", "cv"]
8+
categories = ["api-bindings", "computer-vision", "external-ffi-bindings", "multimedia"]
89
license = "MIT"
910
version = "0.95.1"
1011
# bump edition to 2024 when MSRV is 1.85
1112
edition = "2021"
1213
rust-version = "1.77.0"
1314
authors = ["Pro <[email protected]>", "Mathieu Poumeyrol <[email protected]>"]
14-
exclude = ["/.github", "/ci", "/tools", ".editorconfig", ".gitattributes", ".gitignore", "release.toml", "rustfmt.toml"]
15+
exclude = ["/.github", "/ci", "/tools", "/.editorconfig", "/.gitattributes", "/release.toml", "/rustfmt.toml", ".gitignore"]
1516

1617
[lib]
1718
doctest = false

TROUBLESHOOTING.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Troubleshooting
22

3-
1. One of the common problems is link errors in the end of the build.
3+
1. One of the common problems is link errors at the end of the build.
44

55
Be sure to set up the relevant environment variables that will allow the linker to find the libraries it
6-
needs (see below).
6+
needs (see [Environment variables](https://github.com/twistedfall/opencv-rust/blob/master/README.md#environment-variables)).
77

88
2. You're getting runtime errors like:
99
```
@@ -47,7 +47,7 @@
4747
Be sure to add `opencv_img_hash460` to your `OPENCV_LINK_LIBS` environment variable because it's being built as a separate
4848
file.
4949

50-
7. On macOS you're getting the `dyld: Library not loaded: @rpath/libclang.dylib` error during the build process.
50+
7. On macOS, you're getting the `dyld: Library not loaded: @rpath/libclang.dylib` error during the build process.
5151

5252
OS can't find `libclang.dylib` dynamic library because it resides in a non-standard path, set up
5353
the `DYLD_FALLBACK_LIBRARY_PATH` environment variable to point to the path where libclang.dylib can be
@@ -89,15 +89,5 @@
8989

9090
## Reporting issues
9191

92-
If you still have trouble using the crate after going through the Troubleshooting steps please fill free to
92+
If you still have trouble using the crate after going through the Troubleshooting steps, please fill free to
9393
report it to the [bugtracker](https://github.com/twistedfall/opencv-rust/issues).
94-
95-
When reporting an issue please state:
96-
97-
1. Operating system
98-
2. The way you installed OpenCV: package, official binary distribution, manual compilation, etc.
99-
3. OpenCV version
100-
4. Attach the full output of the following command from your project directory:
101-
```shell script
102-
RUST_BACKTRACE=full cargo build -vv
103-
```

binding-generator/src/comment.rs

Lines changed: 160 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub fn strip_doxygen_comment_markers(comment: &str) -> String {
2020
let mut comment_type = CommentType::SingleLineDelimited;
2121
let mut lines = Vec::with_capacity(128);
2222
// first pass:
23-
// 1. checks whether the comment is single-line or multi-line delimited
24-
// 2. checks whether multiline comment is asterisk prefixed
23+
// 1. checks whether a comment is single-line or multi-line delimited
24+
// 2. checks whether a multiline comment is asterisk prefixed
2525
// 3. strips comment delimiters for multiline and single line comments
2626
// 4. collects resulting stripped lines into `lines` Vec
2727
for (i, mut line) in comment.lines_with_nl().enumerate() {
@@ -144,16 +144,169 @@ mod test {
144144
assert_eq!("test", &strip_doxygen_comment_markers("// test"));
145145
assert_eq!("test", &strip_doxygen_comment_markers("/*test */"));
146146

147+
// multiline with prefix
147148
{
148-
let comment = "/** @overload
149-
* @brief It's the same function as #calibrateCameraAruco but without calibration error estimation.
150-
*/";
149+
let comment = "\
150+
/**
151+
* line1
152+
* line2
153+
*/
154+
";
155+
let expected = "\
156+
line1
157+
line2";
158+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
159+
}
151160

152-
let expected = "@overload
153-
@brief It's the same function as #calibrateCameraAruco but without calibration error estimation.";
161+
// multiline without prefix
162+
{
163+
let comment = "\
164+
/*
165+
line1
166+
line2
167+
*/
168+
";
169+
let expected = "\
170+
line1
171+
line2";
172+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
173+
}
174+
175+
// multiline with indent and no end marker
176+
{
177+
let comment = "\
178+
/** line1
179+
* line2
180+
* line3
181+
";
182+
let expected = "\
183+
line1
184+
line2
185+
line3";
186+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
187+
}
188+
189+
// multiline with MD unordered list
190+
{
191+
let comment = "\
192+
/* line1
193+
* line2
194+
line3
195+
* line4
196+
*/
197+
";
198+
let expected = "\
199+
line1
200+
* line2
201+
line3
202+
* line4";
203+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
204+
}
205+
206+
// multiline with indent on a single line
207+
{
208+
let comment = "\
209+
/**
210+
* line1
211+
* line2
212+
line3
213+
*/
214+
";
215+
let expected = "\
216+
line1
217+
line2
218+
line3";
219+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
220+
}
221+
222+
// multiline, end marker on the same line
223+
{
224+
let comment = "\
225+
/** line1
226+
line2
227+
line3*/
228+
";
229+
let expected = "\
230+
line1
231+
line2
232+
line3";
233+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
234+
}
235+
236+
// two multiline glued
237+
{
238+
let comment = "\
239+
/** line1
240+
line2*/
241+
/** line3 */
242+
";
243+
let expected = "\
244+
line1
245+
line2
246+
line3";
247+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
248+
}
249+
250+
// multiline with empty lines inside and at the end
251+
{
252+
let comment = "\
253+
/** line1
254+
255+
line2
256+
257+
*/
258+
";
259+
let expected = "\
260+
line1
261+
262+
line2";
263+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
264+
}
265+
266+
// multiline with empty lines and indent
267+
{
268+
let comment = "\
269+
/**
270+
line1
271+
272+
line2
273+
*/
274+
";
275+
let expected = "\
276+
line1
277+
278+
line2";
279+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
280+
}
281+
282+
// multiline with indent when the first line is on the same line as the start marker
283+
{
284+
let comment = "\
285+
/** line1
286+
287+
line2
288+
*/
289+
";
290+
let expected = "\
291+
line1
292+
293+
line2";
294+
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
295+
}
296+
297+
// single-line with exclamation mark
298+
{
299+
let comment = "\
300+
//!< line1
301+
//!< line2
302+
";
303+
let expected = "\
304+
line1
305+
line2";
154306
assert_eq!(expected, &strip_doxygen_comment_markers(comment));
155307
}
156308

309+
// single-line
157310
{
158311
let comment = "// @overload
159312
// @brief It's the same function as #calibrateCameraAruco but without calibration error estimation.

0 commit comments

Comments
 (0)