1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// This file is part of helpers4.
// Copyright (C) 2025 baxyz
// SPDX-License-Identifier: LGPL-3.0-or-later
use ;
use ;
/// What this module knows about the license with SPDX identifier `id`.
///
/// The match ignores case (SPDX identifiers are case-insensitive) and accepts the deprecated
/// identifiers that are still common (`GPL-3.0`, `LGPL-2.1+`, `AGPL-3.0`, ...), answering with the
/// current one (see [`normalize`](super::normalize)). About forty common licenses are known; for
/// any other identifier the answer is `None`, which means "not in this list", not "invalid".
///
/// # Arguments
///
/// - `id` - The SPDX identifier, such as `"MIT"` or `"Apache-2.0"`.
///
/// # Returns
///
/// The [`LicenseInfo`], or `None` for an identifier that is not known.
///
/// # Examples
///
/// ```
/// use helpers4::license::{lookup, Category};
///
/// assert_eq!(lookup("MPL-2.0").map(|i| i.category()), Some(Category::WeakCopyleft));
/// assert_eq!(lookup("gpl-3.0").map(|i| i.id()), Some("GPL-3.0-only"));
/// assert_eq!(lookup("Not-A-License"), None);
/// ```