Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added array containing all blocks #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ license = "MIT"
include = ["src/**/*", "Cargo.toml", "README.md", "LICENSE"]

[dependencies]

[features]
default = []
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed.

# Include an array that contains references to all unicode blocks.
all = []
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
Unicode Blocks
====================
# `unicode-blocks`

[![CI](https://github.com/magiclen/unicode-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/unicode-blocks/actions/workflows/ci.yml)
[![Documentation](https://docs.rs/unicode-blocks/badge.svg)](https://docs.rs/unicode-blocks)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not used to using this badge.

Copy link
Author

@virtualritz virtualritz Apr 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not used to using this badge.

Most users are though.

If you look at the average popular crate updated in the last two years on crates.io, you'll probably see badges for build/CI status, crates.io version and docs.rs link at the top of the README.

The latter two are for people coming to/accrorss the crate via the repo and not via crates.io. I.e. they will have to dig to find out if this is a published crate at all and if there are docs (the former does not imply the latter, some crates have shoddy docs or the docs.rs build fails).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I will think about it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if shields.io is trustworthy. Displaying their badges might be promoting their services.

Copy link
Author

@virtualritz virtualritz Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.
It's seems what most Rust crate repos on GH are using.
I used something else two years back (forgot the name) but that stopped working some time ago so I switched to shields.io just copying what I saw in others's READMEs.

[![Crate](https://img.shields.io/crates/v/unicode-blocks.svg)](https://crates.io/crates/unicode-blocks)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not used to using this badge.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.


This crate contains a list of all unicode blocks and provides some functions to search across them.

## Features

* `all` – Include an array that contains references to all unicode blocks.

As this takes quite a bit of memory (approx 2.6k on a 64bit system) this is
turned off by default.

## Examples

#### Given a character, determine what unicode block contains it.

```rust
assert_eq!(unicode_blocks::BASIC_LATIN, unicode_blocks::find_unicode_block('A').unwrap());
assert_eq!(
unicode_blocks::BASIC_LATIN,
unicode_blocks::find_unicode_block('A').unwrap()
);
```

#### Given a unicode block, determine whether it is used in CJK.

```rust
assert!(unicode_blocks::is_cjk_block(unicode_blocks::CJK_UNIFIED_IDEOGRAPHS));
assert!(
unicode_blocks::is_cjk_block(unicode_blocks::CJK_UNIFIED_IDEOGRAPHS)
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to use line breaks?

```

#### Given a character, determine whether it is in CJK.
Expand All @@ -25,14 +38,6 @@ assert!(unicode_blocks::is_cjk_block(unicode_blocks::CJK_UNIFIED_IDEOGRAPHS));
assert!(unicode_blocks::is_cjk('。'));
```

## Crates.io

https://crates.io/crates/unicode-blocks

## Documentation

https://docs.rs/unicode-blocks

Copy link
Owner

@magiclen magiclen Apr 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All my crates on crates.io have them in README.md and therefore I don't want to remove them.

## License

[MIT](LICENSE)
Loading