bytemuck crate: Add no_std variant

Enable no_std support for bytemuck crate as uguid crate has no_std
variant and depends on the bytemuck.

Test: m libbytemuck_nostd
Bug: 237386071

Change-Id: Id4df4fdbd54c2180e8cec03fb7f385a653fd191f
diff --git a/crates/bytemuck/Android.bp b/crates/bytemuck/Android.bp
index aa8c8ff..5d51ca5 100644
--- a/crates/bytemuck/Android.bp
+++ b/crates/bytemuck/Android.bp
@@ -197,3 +197,31 @@
     vendor_available: true,
     min_sdk_version: "34",
 }
+
+rust_library_rlib {
+    name: "libbytemuck_nostd",
+    crate_name: "bytemuck",
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.19.0",
+    crate_root: "src/lib.rs",
+    edition: "2018",
+    features: [
+        "bytemuck_derive",
+        "derive",
+        "extern_crate_alloc",
+    ],
+    proc_macros: ["libbytemuck_derive"],
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
+    prefer_rlib: true,
+    no_stdlibs: true,
+    stdlibs: [
+        "liballoc.rust_sysroot",
+        "libcompiler_builtins.rust_sysroot",
+        "libcore.rust_sysroot",
+    ],
+    product_available: true,
+    vendor_available: true,
+}
diff --git a/crates/bytemuck/cargo_embargo.json b/crates/bytemuck/cargo_embargo.json
index 47334a8..ab77544 100644
--- a/crates/bytemuck/cargo_embargo.json
+++ b/crates/bytemuck/cargo_embargo.json
@@ -1,9 +1,30 @@
 {
   "features": [
     "derive",
-    "extern_crate_alloc",
-    "extern_crate_std"
+    "extern_crate_alloc"
   ],
-  "tests": true,
-  "min_sdk_version": "34"
+  "variants": [
+    {
+      "features": [
+        "extern_crate_std",
+        "derive",
+        "extern_crate_alloc"
+      ],
+      "tests": true,
+      "min_sdk_version": "34"
+    },
+    {
+      "module_name_overrides": {
+        "libbytemuck": "libbytemuck_nostd"
+      },
+      "package": {
+        "bytemuck": {
+          "force_rlib": true,
+          "host_supported": false,
+          "alloc": true,
+          "no_std": true
+        }
+      }
+    }
+  ]
 }