Forráskód Böngészése

Merge pull request #273 from dave-tucker/fix_sidebar

xtask: Add all crates to sidebar
Dave Tucker 2 éve
szülő
commit
9904237ac1
2 módosított fájl, 15 hozzáadás és 8 törlés
  1. 7 7
      aya/src/programs/cgroup_sock_addr.rs
  2. 8 1
      xtask/src/docs/mod.rs

+ 7 - 7
aya/src/programs/cgroup_sock_addr.rs

@@ -17,9 +17,9 @@ use crate::{
 
 /// A program that can be used to inspect or modify socket addresses (`struct sockaddr`).
 ///
-/// [`SockAddr`] programs can be used to inspect or modify socket addresses passed to
+/// [`CgroupSockAddr`] programs can be used to inspect or modify socket addresses passed to
 /// various syscalls within a [cgroup]. They can be attached to a number of different
-/// places as described in [`SockAddrAttachType`].
+/// places as described in [`CgroupSockAddrAttachType`].
 ///
 /// [cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html
 ///
@@ -68,7 +68,7 @@ impl CgroupSockAddr {
 
     /// Attaches the program to the given cgroup.
     ///
-    /// The returned value can be used to detach, see [SockAddr::detach].
+    /// The returned value can be used to detach, see [CgroupSockAddr::detach].
     pub fn attach<T: AsRawFd>(&mut self, cgroup: T) -> Result<CgroupSockAddrLinkId, ProgramError> {
         let prog_fd = self.data.fd_or_err()?;
         let cgroup_fd = cgroup.as_raw_fd();
@@ -115,7 +115,7 @@ impl CgroupSockAddr {
 
     /// Detaches the program.
     ///
-    /// See [SockAddr::attach].
+    /// See [CgroupSockAddr::attach].
     pub fn detach(&mut self, link_id: CgroupSockAddrLinkId) -> Result<(), ProgramError> {
         self.data.links.remove(link_id)
     }
@@ -152,15 +152,15 @@ impl Link for CgroupSockAddrLinkInner {
 }
 
 define_link_wrapper!(
-    /// The link used by [SockAddr] programs.
+    /// The link used by [CgroupSockAddr] programs.
     CgroupSockAddrLink,
-    /// The type returned by [SockAddr::attach]. Can be passed to [SockAddr::detach].
+    /// The type returned by [CgroupSockAddr::attach]. Can be passed to [CgroupSockAddr::detach].
     CgroupSockAddrLinkId,
     CgroupSockAddrLinkInner,
     CgroupSockAddrLinkIdInner
 );
 
-/// Defines where to attach a [`SockAddr`] program.
+/// Defines where to attach a [`CgroupSockAddr`] program.
 #[derive(Copy, Clone, Debug)]
 pub enum CgroupSockAddrAttachType {
     /// Attach to IPv4 bind events.

+ 8 - 1
xtask/src/docs/mod.rs

@@ -3,7 +3,7 @@ use std::{
     process::Command,
 };
 
-use std::{fs, io};
+use std::{fs, io, io::Write};
 
 pub fn docs() -> Result<(), anyhow::Error> {
     let mut working_dir = PathBuf::from(".");
@@ -33,6 +33,13 @@ pub fn docs() -> Result<(), anyhow::Error> {
 
     copy_dir_all("./bpf/target/doc", "./target/doc")?;
 
+    let crates_js = b"window.ALL_CRATES = [\"aya\", \"aya_bpf\", \"aya_bpf_bindings\", \"aya_bpf_cty\", \"aya_bpf_macros\", \"aya_gen\"];\n";
+    let mut file = fs::File::options()
+        .read(true)
+        .write(true)
+        .open("./target/doc/crates.js")?;
+    file.write_all(crates_js)?;
+
     Ok(())
 }