Skip to content

Commit 46e6ad4

Browse files
committed
Update documentation
1 parent c8696f7 commit 46e6ad4

3 files changed

Lines changed: 38 additions & 24 deletions

File tree

.github/workflows/tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ jobs:
5959
- name: Check no-default-features with std
6060
run: cargo check --no-default-features --features std
6161

62+
docs:
63+
64+
name: Docs
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout source
68+
uses: actions/checkout@v4
69+
with:
70+
submodules: recursive
71+
show-progress: false
72+
73+
- name: Set up Rust toolchain
74+
uses: Systemcluster/actions@setup-rust-v0
75+
with:
76+
channel: nightly
77+
cache-key-job: true
78+
79+
- name: Check docs.rs
80+
env:
81+
RUSTDOCFLAGS: --cfg docsrs
82+
run: cargo doc
83+
6284
tests:
6385

6486
name: Tests

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ Compared to other resource editors like [rcedit](https://github.com/electron/rce
2020

2121
### Library
2222

23-
Add `editpe` as a dependency. Support for converting and resizing images in other formats when setting icons is provided by the `image` crate.
23+
Add `editpe` as a dependency. The `std` and `images` features are enabled by default and can be disabled for `no-std` support.
2424

2525
```toml
2626
editpe = "0.2"
27-
image = "*" # to support additional icon file types
27+
image = { version = "*", features = ["png"] } # to support additional icon file types
2828
```
2929

30-
The `std` and `images` features are enabled by default and can be disabled for `no-std` support.
3130

3231
#### Examples
3332

src/lib.rs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,30 @@
1111
//!
1212
//! # Examples
1313
//!
14-
//! ### Replacing the icon of an executable
14+
//! ### Adding an icon or manifest to an executable
1515
//! ```
16-
//! use editpe::Image;
17-
//!
16+
//! # use editpe::Image;
1817
//! let mut image = Image::parse_file("damocles.exe")?;
19-
//!
20-
//! // get the resource directory
2118
//! let mut resources = image.resource_directory().cloned().unwrap_or_default();
22-
//! // set the icon file
19+
//!
2320
//! resources.set_main_icon_file("sword.png")?;
24-
//! // set the resource directory in the image
25-
//! image.set_resource_directory(resources)?;
2621
//!
27-
//! // write an executable image with all changes applied
22+
//! let manifest = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
23+
//! resources.set_manifest(manifest)?;
24+
//!
25+
//! image.set_resource_directory(resources)?;
2826
//! image.write_file("damocles.exe");
2927
//! ```
3028
//!
3129
//! ### Transferring resources between executables
3230
//! ```
33-
//! use editpe::Image;
34-
//!
35-
//! let image = Image::parse_file("damocles.exe")?;
36-
//! // get the resource directory from the source
31+
//! # use editpe::Image;
32+
//! let source = Image::parse_file("damocles.exe")?;
3733
//! let resources = image.resource_directory()?;
3834
//!
39-
//! let mut image = Image::parse_file("fortuna.exe")?;
40-
//! // copy the resource directory to the target
41-
//! image.set_resource_directory(resources)?;
42-
//!
43-
//! // write an executable image with all changes applied
44-
//! image.write_file("fortuna.exe");
35+
//! let mut target = Image::parse_file("fortuna.exe")?;
36+
//! target.set_resource_directory(resources)?;
37+
//! target.write_file("fortuna.exe");
4538
//! ```
4639
//!
4740
//! # Cargo features
@@ -52,8 +45,8 @@
5245
//! - `images`: Enables support for converting and resizing images in other formats when setting icons. Also enables `std`.
5346
5447
#![cfg_attr(not(feature = "std"), no_std)]
55-
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide))]
56-
#![cfg_attr(docsrs, doc(cfg_hide(doc)))]
48+
#![cfg_attr(docsrs, feature(doc_cfg))]
49+
#![cfg_attr(docsrs, doc(auto_cfg))]
5750

5851
extern crate alloc;
5952

0 commit comments

Comments
 (0)