Skip to content
Merged
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
4 changes: 4 additions & 0 deletions assets/javascripts/news.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
[
"2026-07-27",
"New documentation: <a href=\"/tokio/\">Tokio</a>"
],
[
"2026-07-09",
"New documentation: <a href=\"/maplibre_gl/\">MapLibre GL JS</a>"
Expand Down
1 change: 1 addition & 0 deletions assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
@use 'pages/tcl_tk';
@use 'pages/tensorflow';
@use 'pages/terraform';
@use 'pages/tokio';
@use 'pages/typescript';
@use 'pages/underscore';
@use 'pages/vue';
Expand Down
10 changes: 10 additions & 0 deletions assets/stylesheets/pages/_tokio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@use 'pages/simple';

._tokio {
@extend %simple;

.stab {
@extend %note;
@extend %note-orange;
}
}
32 changes: 32 additions & 0 deletions lib/docs/filters/tokio/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Docs
class Tokio
class CleanHtmlFilter < Filter
def call
css('.main-heading h1').each do |node|
node.parent.replace(node)
end

doc.css(
'a.doc-anchor',
'a.anchor',
'a.src',
'button#copy-path',
'.rustdoc-breadcrumbs',
'.sub-heading'
).remove

doc.css('pre.rust').each do |code|
code['data-language'] = 'rust'
end

# Get rid of toggles hiding useful info.
doc.css('details').each do |node|
node.name = 'div'
end
doc.css('summary.hideme').remove

doc
end
end
end
end
35 changes: 35 additions & 0 deletions lib/docs/filters/tokio/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module Docs
class Tokio
class EntriesFilter < Docs::EntriesFilter
def get_name
namespace = at_css('.rustdoc-breadcrumbs').inner_text
header = at_css('h1 > span').inner_text
"#{namespace}::#{header}"
end

def get_type
header = at_css('h1').inner_text

if header.include?('Attribute Macro')
'Attribute Macros'
elsif header.include?('Macro')
'Macros'
elsif header.include?('Module')
'Modules'
elsif header.include?('Struct')
'Structs'
elsif header.include?('Function')
'Functions'
elsif header.include?('Enum')
'Enums'
elsif header.include?('Trait')
'Traits'
elsif header.include?('Type')
'Types'
else
'Other'
end
end
end
end
end
31 changes: 31 additions & 0 deletions lib/docs/scrapers/tokio.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module Docs
class Tokio < UrlScraper
self.name = 'Tokio'
self.type = 'tokio'
self.root_path = 'index.html'
self.links = {
home: 'https://tokio.rs/',
code: 'https://github.com/tokio-rs/tokio'
}

html_filters.push 'tokio/entries', 'tokio/clean_html'

options[:rate_limit] = 50
options[:container] = 'section.content'
options[:skip_patterns] = [/\/next|\/\d\.\d*/, /rabbitmq\//]
options[:attribution] = <<-HTML
MIT License<br />
Copyright &copy; Tokio Contributors
HTML

version do
self.release = '1.53.1'
self.base_url = "https://docs.rs/tokio/#{self.release}/tokio/"
end

def get_latest_version(opts)
doc = fetch_doc('https://docs.rs/tokio/latest/tokio/index.html', opts)
doc.at_css('h2 > .version').content.strip
end
end
end
Binary file added public/icons/docs/tokio/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/docs/tokio/16@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/docs/tokio/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://upload.wikimedia.org/wikipedia/commons/6/60/Tokio_logo.svg
Loading