Skip to content

Commit a630bb6

Browse files
committed
partially fix docs
1 parent 2c2510d commit a630bb6

File tree

5 files changed

+27
-32
lines changed

5 files changed

+27
-32
lines changed

crates/amf0/README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,37 @@
1919
A pure-rust implementation of AMF0 encoder and decoder.
2020

2121
This crate provides serde support for serialization and deserialization of AMF0 data.
22+
## Specification
2223

23-
See the [changelog](./CHANGELOG.md) for a full release history.
24+
| Name | Version | Link | Comments |
25+
| --- | --- | --- | --- |
26+
| Action Message Format -- AMF 0 | - | <https://rtmp.veriskope.com/pdf/amf0-file-format-specification.pdf> | Refered to as 'AMF0 spec' in this documentation |
2427

25-
### Feature flags
28+
## Limitations
2629

27-
* **`serde`** — Enables serde support
28-
* **`docs`** — Enables changelog and documentation of feature flags
30+
- Does not support AMF0 references.
31+
- Does not support the AVM+ Type Marker. (see AMF 0 spec, 3.1)
2932

30-
### Specification
33+
## Example
3134

32-
|Name|Version|Link|Comments|
33-
|----|-------|----|--------|
34-
|Action Message Format – AMF 0|-|<https://rtmp.veriskope.com/pdf/amf0-file-format-specification.pdf>|Refered to as ‘AMF0 spec’ in this documentation|
35-
36-
### Limitations
37-
38-
* Does not support AMF0 references.
39-
* Does not support the AVM+ Type Marker. (see AMF 0 spec, 3.1)
40-
41-
### Example
42-
43-
````rust
35+
```rust
36+
# fn test() -> Result<(), Box<dyn std::error::Error>> {
37+
# let bytes = &[0x02, 0, 1, b'a'];
38+
# let mut writer = Vec::new();
4439
// Decode a string value from bytes
4540
let value: String = scuffle_amf0::from_slice(bytes)?;
4641

4742
// .. do something with the value
4843

4944
// Encode a value into a writer
5045
scuffle_amf0::to_writer(&mut writer, &value)?;
51-
````
46+
# assert_eq!(writer, bytes);
47+
# Ok(())
48+
# }
49+
# test().expect("test failed");
50+
```
5251

53-
### License
52+
## License
5453

5554
This project is licensed under the MIT or Apache-2.0 license.
5655
You can choose between one of them if you use this work.

crates/amf0/src/decoder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ mod tests {
379379
*object.get(&StringCow::from_static("abc")).unwrap(),
380380
Amf0Value::String("val".into())
381381
);
382-
assert_eq!(*object.get("defg").unwrap(), Amf0Value::Boolean(true));
382+
assert_eq!(
383+
*object.get(&StringCow::from_static("defg")).unwrap(),
384+
Amf0Value::Boolean(true)
385+
);
383386
}
384387

385388
#[test]

crates/amf0/src/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ where
8383
Ok(())
8484
}
8585

86-
/// Encode an [`Amf0Array`] as an AMF0 StrictArray value.
86+
/// Encode an Amf0Array as an AMF0 StrictArray value.
8787
pub fn encode_array<'a, I, B>(&mut self, values: I) -> Result<(), Amf0Error>
8888
where
8989
B: Borrow<Amf0Value<'a>>,

crates/amf0/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
//!
4242
//! `SPDX-License-Identifier: MIT OR Apache-2.0`
4343
#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
44-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
44+
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
4545
#![deny(missing_docs)]
4646
#![deny(unsafe_code)]
4747
#![deny(unreachable_pub)]

crates/amf0/src/object.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! This code is modified from https://github.com/serde-rs/json/blob/v1.0.140/src/map.rs
1+
//! This code is modified from <https://github.com/serde-rs/json/blob/v1.0.140/src/map.rs>
22
//!
33
//! A map of scuffle_bytes_util::StringCow to crate::Amf0Value.
44
//!
@@ -362,13 +362,6 @@ impl<'a> Amf0Object<'a> {
362362
/// favor of an alphanumerical order that matches how a BTreeMap with the
363363
/// same contents would be ordered. This takes **O(n log n + c)** time where
364364
/// _n_ is the length of the map and _c_ is the capacity.
365-
///
366-
/// Other maps nested within the values of this map are not sorted. If you
367-
/// need the entire data structure to be sorted at all levels, you must also
368-
/// call
369-
/// <code>map.[values_mut]\().for_each([Value::sort_all_objects])</code>.
370-
///
371-
/// [values_mut]: Map::values_mut
372365
#[inline]
373366
pub fn sort_keys(&mut self) {
374367
#[cfg(feature = "preserve_order")]
@@ -640,9 +633,9 @@ where
640633
//////////////////////////////////////////////////////////////////////////////
641634

642635
/// A view into a single entry in a map, which may either be vacant or occupied.
643-
/// This enum is constructed from the [`entry`] method on [`Map`].
636+
/// This enum is constructed from the [`entry`] method on [`Amf0Object`].
644637
///
645-
/// [`entry`]: Map::entry
638+
/// [`entry`]: Amf0Object::entry
646639
pub enum Entry<'a, 'b> {
647640
/// A vacant Entry.
648641
Vacant(VacantEntry<'a, 'b>),

0 commit comments

Comments
 (0)