Skip to content

Commit db422c4

Browse files
committed
Refactor icrate README.md/lib.rs
1 parent f6283d2 commit db422c4

File tree

2 files changed

+44
-29
lines changed

2 files changed

+44
-29
lines changed

crates/icrate/README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
[![Documentation](https://docs.rs/icrate/badge.svg)](https://docs.rs/icrate/)
66
[![CI](https://github.com/madsmtm/objc2/actions/workflows/ci.yml/badge.svg)](https://github.com/madsmtm/objc2/actions/workflows/ci.yml)
77

8-
Rust bindings to Apple's frameworks..
8+
Rust bindings to Apple's frameworks.
99

10-
This crate is part of the [`objc2` project](https://github.com/madsmtm/objc2),
11-
see that for related crates, or see [the docs](https://docs.rs/icrate/) for
12-
more details.
10+
This README is kept intentionally small in an effort to consolidate the documentation, see [the Rust docs](https://docs.rs/icrate/) for more details.
1311

1412

1513
## Supported versions
@@ -22,20 +20,3 @@ Currently supports:
2220
- iOS/iPadOS: `7.0-16.2` (WIP)
2321
- tvOS: `9.0-16.1` (WIP)
2422
- watchOS: `1.0-9.1` (WIP)
25-
26-
27-
## Example
28-
29-
```rust
30-
use icrate::Foundation::{ns_string, NSCopying, NSArray};
31-
32-
let string = ns_string!("world");
33-
println!("hello {string}");
34-
35-
let array = NSArray::from_id_slice(&[string.copy()]);
36-
println!("{array:?}");
37-
```
38-
39-
More examples are [available in the repository][examples].
40-
41-
[examples]: https://github.com/madsmtm/objc2/tree/master/crates/icrate/examples

crates/icrate/src/lib.rs

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,47 @@
11
//! # Bindings to Apple's frameworks
22
//!
3-
//! This crate is a mostly autogenerated interface to some of Apple's
4-
//! frameworks. It builds upon [`objc2`] to provide memory management and
5-
//! safety in many areas; see that crate for more details.
3+
//! `icrate` is an autogenerated interface to Apple's Objective-C frameworks
4+
//! like AppKit, Foundation, Metal, WebKit, and so on.
5+
//!
6+
//! The bindings currently contain very little documentation, you should view
7+
//! [Apple's developer documentation][apple-doc-index] for detailed
8+
//! information about each API. (There are [plans][#309] for importing that
9+
//! documentation here).
10+
//!
11+
//! [#309]: https://github.com/madsmtm/objc2/issues/309
12+
//! [apple-doc-index]: https://developer.apple.com/documentation/technologies
13+
//!
14+
//!
15+
//! ## Example
16+
//!
17+
//! ```console
18+
//! $ cargo add icrate --features=Foundation,Foundation_all
19+
//! ```
20+
//!
21+
#![cfg_attr(
22+
all(
23+
feature = "Foundation",
24+
feature = "Foundation_NSArray",
25+
feature = "Foundation_NSString"
26+
),
27+
doc = "```"
28+
)]
29+
#![cfg_attr(
30+
not(all(
31+
feature = "Foundation",
32+
feature = "Foundation_NSArray",
33+
feature = "Foundation_NSString"
34+
)),
35+
doc = "```ignore"
36+
)]
37+
//! use icrate::Foundation::{ns_string, NSCopying, NSArray};
38+
//!
39+
//! let string = ns_string!("world");
40+
//! println!("hello {string}");
41+
//!
42+
//! let array = NSArray::from_id_slice(&[string.copy()]);
43+
//! println!("{array:?}");
44+
//! ```
645
746
#![no_std]
847
#![cfg_attr(feature = "unstable-docsrs", feature(doc_auto_cfg))]
@@ -34,11 +73,6 @@ extern crate std;
3473

3574
#[cfg(doctest)]
3675
#[doc = include_str!("../README.md")]
37-
#[cfg(all(
38-
feature = "Foundation",
39-
feature = "Foundation_NSString",
40-
feature = "Foundation_NSArray"
41-
))]
4276
extern "C" {}
4377

4478
#[cfg(feature = "objective-c")]

0 commit comments

Comments
 (0)