Instant Download Rust for Rustaceans Idiomatic Programming for Experienced Developers Final Release 1st Edition Jon Gjengset PDF All Chapters
Instant Download Rust for Rustaceans Idiomatic Programming for Experienced Developers Final Release 1st Edition Jon Gjengset PDF All Chapters
com
https://ebookmeta.com/product/rust-for-rustaceans-idiomatic-
programming-for-experienced-developers-final-release-1st-
edition-jon-gjengset/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/rust-for-rustaceans-1st-edition-jon-
gjengset/
ebookmeta.com
https://ebookmeta.com/product/geometry-for-programmers-final-
release-1st-edition-oleksandr-kaleniuk/
ebookmeta.com
https://ebookmeta.com/product/learning-go-an-idiomatic-approach-to-
real-world-go-programming-2nd-edition-jon-bodner/
ebookmeta.com
https://ebookmeta.com/product/cyber-law-and-ethics-regulation-of-the-
connected-world-1st-edition-mark-grabowski/
ebookmeta.com
https://ebookmeta.com/product/coloniality-of-the-us-mexico-border-
power-violence-and-the-decolonial-imperative-1st-edition-roberto-d-
hernandez/
ebookmeta.com
https://ebookmeta.com/product/sound-art-concepts-and-practices-1st-
edition-thom-holmes/
ebookmeta.com
https://ebookmeta.com/product/biology-of-sharks-and-their-relatives-
third-edition-jeffrey-c-carrier/
ebookmeta.com
Don t Shut Up How To Talk So The World Listens 1st Edition
Prakhar Gupta
https://ebookmeta.com/product/don-t-shut-up-how-to-talk-so-the-world-
listens-1st-edition-prakhar-gupta/
ebookmeta.com
RUST FOR
RUS TACE A NS
I D I O M A T I C P R O G R A M M I N G F O R
E X P E R I E N C E D D E V E L O P E R S
JON GJENGSET
RUST FOR RUSTACEANS
RUST FOR
R U S TA C E A N S
Idiomatic Programming for
Experienced Developers
b y Jon G j e n g s e t
San Francisco
RUST FOR RUSTACEANS. Copyright © 2022 by Jon Gjengset.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
First printing
25 24 23 22 21 123456789
For information on book distributors or translations, please contact No Starch Press, Inc. directly:
No Starch Press, Inc.
245 8th Street, San Francisco, CA 94103
phone: 1.415.863.9900; [email protected]
www.nostarch.com
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other
product and company names mentioned herein may be the trademarks of their respective owners. Rather
than use a trademark symbol with every occurrence of a trademarked name, we are using the names only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of
the trademark.
The information in this book is distributed on an “As Is” basis, without warranty. While every precaution
has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any
liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly
or indirectly by the information contained in it.
About the Author
Jon Gjengset has worked in the Rust ecosystem since the early days of
Rust 1.0, and built a high-performance relational database from scratch
in Rust over the course of his PhD at MIT. He’s been a frequent contributor
to the Rust toolchain and ecosystem, including the asynchronous runtime
Tokio, and maintains several popular Rust crates, such as hdrhistogram and
inferno. Jon has been teaching Rust since 2018, when he started live-stream-
ing intermediate-level Rust programming sessions. Since then, he’s made
videos that cover advanced topics like async and await, pinning, variance,
atomics, dynamic dispatch, and more, which have been received enthusiasti-
cally by the Rust community.
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Chapter 1: Foundations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2: Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 6: Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
CO N T E N T S I N D E TA I L
FOREWORD xv
PREFACE xvii
ACKNOWLEDGMENTS xix
INTRODUCTION xxi
What’s in the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
1
FOUNDATIONS 1
Talking About Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Memory Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Variables in Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Memory Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Ownership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Borrowing and Lifetimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Shared References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Mutable References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Interior Mutability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Lifetimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2
TYPES 19
Types in Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Complex Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Dynamically Sized Types and Wide Pointers . . . . . . . . . . . . . . . . . . . . . . . . . 23
Traits and Trait Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Compilation and Dispatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Generic Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Coherence and the Orphan Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Trait Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Marker Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Existential Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3
DESIGNING INTERFACES 37
Unsurprising . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Naming Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Common Traits for Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Ergonomic Trait Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Wrapper Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Flexible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Generic Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Object Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Borrowed vs. Owned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Fallible and Blocking Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Obvious . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Type System Guidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Constrained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Type Modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Trait Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Hidden Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4
ERROR HANDLING 57
Representing Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Opaque Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Special Error Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Propagating Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5
PROJECT STRUCTURE 67
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Defining and Including Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using Features in Your Crate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Workspaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Project Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Crate Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Build Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Conditional Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Minimum Supported Rust Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Minimal Dependency Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Changelogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Unreleased Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
x Contents in Detail
6
TESTING 85
Rust Testing Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
The Test Harness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
#[cfg(test)] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Doctests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Additional Testing Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Linting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Test Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Test Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Performance Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7
MACROS 101
Declarative Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
When to Use Them . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
How They Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
How to Write Declarative Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Procedural Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Types of Procedural Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
The Cost of Procedural Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
So You Think You Want a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
How Do They Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
8
ASYNCHRONOUS PROGRAMMING 117
What’s the Deal with Asynchrony? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Synchronous Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Multithreading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Asynchronous Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Standardized Polling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Ergonomic Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
async/await . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Pin and Unpin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Going to Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Waking Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Fulfilling the Poll Contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Waking Is a Misnomer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Tasks and Subexecutors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Tying It All Together with spawn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
9
UNSAFE CODE 141
The unsafe Keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Great Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Juggling Raw Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Contents in Detail xi
Calling Unsafe Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Implementing Unsafe Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Great Responsibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
What Can Go Wrong? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Panics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
The Drop Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Coping with Fear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Manage Unsafe Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Read and Write Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Check Your Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
10
CONCURRENCY (AND PARALLELISM) 167
The Trouble with Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Correctness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Concurrency Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Shared Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Worker Pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Actors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Asynchrony and Parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Lower-Level Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Memory Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Atomic Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Memory Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Compare and Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
The Fetch Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Sane Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Start Simple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Write Stress Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Use Concurrency Testing Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
11
FOREIGN FUNCTION INTERFACES 193
Crossing Boundaries with extern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Calling Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Types Across Language Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Type Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Allocations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
bindgen and Build Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
13
THE RUST ECOSYSTEM 223
What’s Out There? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Rust Tooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
The Standard Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Patterns in the Wild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Index Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Drop Guards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Extension Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Crate Preludes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Staying Up to Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
What Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Learn by Watching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Learn by Doing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Learn by Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Learn by Teaching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
INDEX 245
55. Sed reversus ad eum qui missit illum revertere vero eo hinc, et
in primo mari transito cœpto qui erat parum itinere in Britonum
finibus vita factus.—Ib., App. i.
63. These and the other notices of St. Ternan will be found
conveniently collected together in the Preface by the late Bishop of
Brechin to the Missal of Arbuthnot.
65. This life is printed in the Chronicles of the Picts and Scots, p.
412.
66. The chronicle in the Scala Cronica has under this Brude, ‘En
quel temps veint Saint Servanus en Fiffe.’—Chron. of Picts and Scots,
p. 201.
67. Chron. Picts and Scots, p, 410. The church was probably
Carbuddo, or Castrum Boethii, near Dunnichen, the old name of
which was Duin Nechtain.
68. Lanigan, Ec. Hist., vol. i. p. 432. In Ireland the custom existed
of prefixing the word mo or ‘my,’ and adding the word oc, or ‘little,’
to the name of a saint, as an expression of endearment. When the
name ended with the syllable an, the word oc was substituted for it.
Thus Colman becomes Mocholmoc.
71. The old chronicles have ‘Yona insula, ubi tres filii Erc, seu
Fergus, Loarn, et Angus sepulti fuerunt.’—Ib. pp. 151, 174, 288.
Fordun says of Gabran, ‘cujus ad sepeliendum corpus ad ecclesiam
Sancti Orani delatum est, ubi patris et avi funera quiescunt in Hy
insula.’—B. iii. c. 24.
72. Angus has Secht n-epscoip na Hii, and also Secht n-epscoip
Cille Hiæ—‘The seven bishops of Hii,’ and ‘The seven bishops of the
church of Ia.’
73. Colgan, A.SS. p. 112. Mula certainly is Mull, and the old parish
of Kilnoening in Mull probably takes its name from him.
74. An. IV. Mag., vol. i. p. 187. In the Martyrology of Tamlacht this
Odhran appears on 2d October as Odran Lathracha; and again on
27th October as Odrani sac. Lettracha vel o Hi, that is, ‘Odran, priest
of Latteragh, or of Iona.’ Angus the Culdee has on 27th October
Odran Abb. Saer Snamach, ‘Odran, Abbot, noble swimmer’; and in
the gloss it is said he was either ‘Odran the priest of Tech Aireran in
Meath, or Odrain of Lethracha-Odhrain in Muskerry, and of Hi
Columcille—that is, of Relic Odrain in Hii.’—(Forbes, Calendars, p.
426.) This identification of the Oran of Relic Oran in Iona with Oran
of Latteragh places his death in 548, fifteen years before Columba,
with whom he is connected in popular tradition, came to Scotland.
The first appearance of this story is in the old Irish Life of Columba.
It is as follows:—‘Columcille said thus to his people, It would be well
for us that our roots should pass into the earth here. And he said to
them, It is permitted to you that some one of you go under the
earth of this island to consecrate it. Odhran arose quickly and thus
spake, If you accept me, said he, I am ready for that. O Odhran,
said Columcille, you shall receive the reward of this; no request shall
be granted to any one at my tomb unless he first ask of thee.
Odhran then went to heaven. He founded the church of Hy there.’
This story, however, was unknown to Adamnan, who records the
natural death of one of the brethren whose name was either Brito or
who was a Briton, and adds that he was the first of the brethren
who died in the island (B. iii. c. 7). Neither does the name of Odran
appear in the oldest lists of the twelve companions of Columba; and
Angus the Culdee expressly says the Odran celebrated on 27th
October was an abbot, which the Oran of the tradition could not
have been. The epithet of swimmer, too, alludes to an incident in the
life of S. Odran of Latteragh.—See Colgan, A.SS., p. 372.
75. See Lives of the Cambro-British Saints, pp. 272, 602, for an
account of Brychan and his family. He had an impossible number of
children, varying in different legends from ten to twenty-four sons
and twenty-six daughters. It has already been remarked (see vol. i.
p. 160, note, and the Four Ancient Books of Wales, vol. i. p. 82) that
some of these sons and daughters are connected with Brycheiniog
or Brecknock in Wales, and others with Manau Guotodin in the
north, and with the men of the north. It is obvious that there must
have been two Brychans, and that two different families have been
mixed together. The name Brychan comes from Brych, ‘speckled,’ the
Gaelic equivalent of which is Breacc, and seems to refer to a
characteristic of the Picts. It enters into the name Brycheiniog or
Brecknock in Wales, and we also find it in two different localities in
Scotland. In Manau Guotodin, the chief church, that of Falkirk, was
called Ecglis Breacc, or ‘the Speckled Church,’ the Saxon equivalent
of which was Fahkirk, from the word Fah, signifying speckled. There
is also the river Briech, and on the Firth of Forth Briechness, now
Bridgeness. In Forfarshire we have also Brechin. The northern family
seem to have been the same as that of the ten sons of Braccan, son
of Bracha Meoc, king of the Britons, who found churches in Ireland,
as one of the sons, Iust, is said to have been of Sleamna in Alban or
Scotland; and another, Maconoc, we find in the patron saint of
Inverkeilor in Forfarshire. There is there also a church called Neveth,
and in the Cognatio the sepulchre of Brachan or Brychan is said to
be ‘in insula que vocata Enysbrachan, que est juxta Manniam.’
Mannia stands here for Manau in the north, and it is possible that
Inchbrayoch in Forfarshire, which was dedicated to Saint Braoch,
may be the island meant.
79. See Miss Cusack’s Life of Saint Patrick, p. 613, for this epistle
and a translation, and for the expressions above quoted.
CHAPTER II.
The second order Assuming that the three orders of the saints
of Catholic pictured the leading characteristics of three
Presbyters. periods of the Irish Church, there can be no
question that the great feature of the second period was its
monastic character. The principal points of difference in the
constitution of the Church represented by the first two orders were
these:—The first order ‘was of Catholic saints,’ the second ‘of
Catholic presbyters.’ In the first they are said to have been ‘all
bishops, founders of Churches’; in the second there were ‘few
bishops and many presbyters, in number 300.’ In the first ‘they had
one head, Christ, and one chief, Patricius’; in the second ‘they had
one head, our Lord,’ but no chief. In the first ‘they observed one
mass, one celebration’; in the second ‘they celebrated different
masses, and had different rules.’ In the first ‘they excluded from the
churches neither laymen nor women’; in the second ‘they refused
the services of women, separating them from the monasteries.’[80]
The first, as we have said, exhibits a secular clergy founding
churches; the second a clergy observing rules and founding
monasteries. There were no doubt monasteries in the earlier church,
and, as St. Patrick tells us in his Confession, ‘sons of the Scots and
daughters of the princes are seen to be monks and virgins;’ but
these were accidental features in a church essentially secular, and
the monasteries were probably of the earliest type, when the monks
were laymen, while the clergy, in common with the church at that
period, consisted of bishops with their presbyters and deacons; but
in the second period the entire church appears to have been
monastic, and her whole clergy embraced within the fold of the
monastic rule.
The entire Church Bede well expresses this when, in describing
monastic. one of her offshoots at Lindisfarne, he says, ‘All
Relative position the presbyters, with the deacons, cantors,
of Bishops and
Presbyters. lectors, and the other ecclesiastical orders, along
with the bishop himself, were subject in all things
to the monastic rule.’[81] The Irish Church was therefore at this
period a monastic church in the fullest sense of the term, and the
inevitable effect of this was materially to influence the relation
between the two grades of bishops and presbyters, both as to
position and as to numbers. In order to estimate rightly the nature
of this change, it is necessary to keep in view the distinction
between the power of mission and that of orders. The former is the
source of jurisdiction, and the latter of the functions of the
episcopate. When the two are united, we are presented with a
diocesan episcopacy; but the union is not essential. A monastic
church requires the exercise of episcopal functions within her as
much as any other church, and for that purpose possesses within
her the superior grade of the bishop according to canonical rule;[82]
but when it became customary for the abbot of the monastery as
well as several of the brethren to receive the ordination of the
priesthood, for the purpose of performing the religious rites within
the monastery, the tendency of all monasteries within a church was
to encroach upon the functions of the secular clergy, and not only to
claim exemption from the episcopal jurisdiction, but even to have
within themselves a resident bishop for the exercise of episcopal
functions within the monastery, to whose abbot he was subject as
being under the monastic rule.[83] The idea of transferring
monachism entirely to the clergy of a particular district was not
absolutely unknown in the Western Church.[84] But at this period it
was adopted by the Irish Church in its entirety; and when the entire
church became monastic, the whole episcopate was necessarily in
this position. There was nothing derogatory to the power of
episcopal orders, nothing to reduce the bishops, as a superior grade,
below or even to the level of the presbyters; but the mission, and
the jurisdiction of which it is the source, were not in the bishop, but
in the monastery, and that jurisdiction was necessarily exercised
through the abbot as its monastic head. There was episcopacy in the
church, but it was not diocesan episcopacy. Where the abbot, as was
occasionally the case, was in episcopal orders, the anomaly did not
exist. But the presbyters greatly outnumbered the bishops, and the
abbot in general retained his presbyterian orders only.
The presbyter- When this was the case, the bishop appears as
abbot. a separate member of the community, but ‘the
presbyter-abbot was the more important functionary.’ Bede, the most
observant as he is the most candid of historians, remarked this when
he says that Iona ‘was wont to have always as ruler a presbyter-
abbot, to whose jurisdiction the whole province and even the
bishops themselves were, by an unusual arrangement, bound to
submit;’[85] and again, that ‘the monastery in Iona (not the abbot but
the monastery) for a long time held the pre-eminence over almost
all those of the northern Scots, and all those of the Picts, and had
the direction of their people.’[86] It was this inversion of the
jurisdiction, placing the bishop under that of the monastery, which
Bede pronounced to be an unusual order of things. The episcopate
was in fact in the Monastic Church of Ireland a personal and not an
official dignity; and we find at a later period that inferior
functionaries of the monastery, as the scribe and even the anchorite,
appear to have united the functions of a bishop with their proper
duties.[87]
Monastic Whence then did the Irish Church at this period
character of the derive its monastic character? Monasticism, as we
Church derived know, took its rise in the East; but when
from Gaul.
Athanasius, bishop of Alexandria, took refuge in
Rome from the persecution of the Arians in the year 341, told of the
life of the monks in the east, and wrote a Life of St. Anthony, the
monastic life became at once popular in the west, and all Rome
became filled with monasteries. The term religio, or ‘religion,’ was
given to the monastic institutions, and that of ‘religious’ to all who
followed a monastic rule, in contradistinction to that of ‘secular,’
which was applied to the clergy whose lives were regulated merely
by the general law of the Church. From Italy it was introduced into
Gaul, and it was finally established as an institution in that Church by
Martin, monk and afterwards bishop, who founded the monastery of
Ligugé, the most ancient monastery in Gaul, at the gates of Poitiers,
in 361; and afterwards, when he became bishop of Tours in 372, a
monastery near that city, which bore the name of ‘Majus
Monasterium,’ or Marmoutier; and this monastery became the centre
of monastic life in Gaul.[88]
Monachism From Martin of Tours the monastic influence
reached the Irish reached the Irish Church through two different
Church through channels, and became the means of infusing a
two different
channels. new life into that Church, imparting to it a
character which harmonised better with the tribal
organisation of the social system and exhibited itself in that
marvellous burst of energy which not only filled Ireland with
monasteries, but was carried by its monkish missionaries across the
sea to Britain and the Continent. The legend which connects Patrick
with Martin, narrating that Conchessa, Patrick’s mother, was his
niece, and that Patrick went to Martin at the age of twenty-five, and
after four years’ instruction received from him the monastic habit,
must be abandoned as irreconcilable with the chronology of St.
Patrick’s life, and as introduced at a later period into his acts, as we
shall afterwards see. That, however, which connects Ninian of
Whithern with Martin is more trustworthy. He undoubtedly went to
Rome during the lifetime of Martin, where, according to Bede, he
was trained in the faith and mysteries of religion. He is said, on his
return, to have visited that saint at Tours, and obtained from him
masons for the purpose of building a church after the Roman
manner, which, says Bede, was called Candida Casa, and dedicated
to St. Martin.
First channel This monastery, under the name of the
through the ‘Magnum Monasterium,’ or monastery of Rosnat,
monastery of became known as a great seminary of secular
Candida Casa, or
Whithern, in and religious instruction. In the legend of St.
Galloway. Cairnech we find it mentioned as ‘the house of
Martain,’ and as ‘the monastery of Cairnech.’ He
was the son of Sarran, king of the Britons, by Bobona, daughter of
Loarn son of Erc, who had another daughter, Erca, mother of
Murcertach, afterwards king of Ireland. As Murcertach is said in the
legend to have been at that time with the king of Britain learning
military science, the events there narrated must be placed before
the date of the great battle of Ocha in 478, which was fought by
Lughaidh, who then became king of Ireland, and by Murcertach mac
Erca, and established the throne of Ireland in the line of the
northern Hy Niall. The legend adds that ‘Cairnech went to Erin
before him, and became the first bishop of the clan Niall and of
Teamhar, or Tara, and he was the first martyr and the first monk of
Erin, and the first Brehon of the men of Erin also.’[89] In this legend
the introduction of monachism into Ireland is attributed to Cairnech,
who had been bishop and abbot of the monastery or house of
Martin, or in other words, of Candida Casa; and we find soon after
several of the saints, mentioned as belonging to this second order,
resorting thither for the purpose of being instructed and trained in
the monastic life. We learn from the acts of Tighernac of Clones and
of Eugenius of Ardstraw, who were both natives of Leinster, but
connected with Ulster families on the mother’s side, that, with a
number of others of both sexes, they had been carried off when
boys by pirates and brought to Britain, where they were sent by the
king, at the queen’s intercession, to a holy man, called in the Life of
Tighernac, ‘Monennus,’ and in that of Eugenius, ‘Nennio, called also
Mancennus’ and ‘Manchenius,’ and trained by him in his monastery
of Rosnat, which is also called alba, or ‘white.’[90] When set at liberty
and enabled to return to their own country, they both received
episcopal orders; and Tighernac founded the monastery of Galloon
in Lough Erne, and afterwards that of Cluain-eois or Clones in
Monaghan; while Eugenius founded Ardstrath, now Ardstraw, near
Derry. In the Acts of S. Enda of Aran, too, we are told that, when a
youth, he was sent by his sister to Britain, to the monastery of
Rosnat, where he became the humble disciple of Mancenus, the
‘magister’ of that monastery.[91] He afterwards founded in one of the
Aran islands, on the west coast of Ireland, a monastery containing
one hundred and fifty monks, of which he was the presbyter-abbot.
Saint Monenna too sends one of her family, named Brignat, to the
British island, to the monastery of Rosnat, in order that she might be
trained in the rules of monastic life, after which she returns to
Ireland.[92] Again we are told in the Acts of St. Finnian or Finbarr, of
‘Maghbile,’ or Moyville, that he went as a boy to St. Caelan, abbot of
Noendrum, who placed him under the care of a most holy bishop
called Nennio, who had come in a ship with some of his people to
the harbour of the monastery; and by him he was taken to his own
monastery, termed the ‘Magnum Monasterium,’ and there trained for
several years in the rules and institutions of monastic life.[93] In
another Life, in which he is identified with St. Fridean of Lucca, his
master’s name is called Mugentius, and his monastery ‘Candida.’[94]
Finally, in the preface to the Hymn or Prayer of Mugint, we are told
that ‘Mugint made this hymn in Futerna. The cause was this:—
Finnen of Maghbile went to Mugint for instruction, and Rioc, and
Talmach, and several others with him.’[95] Finnian, having received
episcopal orders, afterwards founded the monastery of Magh Bile or
Moyville, in the county of Down.
There can be little question that the monastery of Rosnat, called
also ‘Alba’ and ‘Candida’ and ‘Futerna,’ and known as the ‘Magnum
Monasterium,’ could have been no other than the monastery of
Candida Casa, known to the Angles as Whithern, of which ‘Futerna’
is the Irish equivalent. The future bishops and abbots who were
trained there were all more or less connected with Ulster; the
monasteries founded by them were in the north of Ireland; and
Finnian, the latest of them, was of the race of Dal Fiatach, occupying
the districts of Down and part of Antrim, separated by the Irish
Channel from Galloway. They would naturally resort to the great
school of monastic life established there by Ninian in honour of St.
Martin of Tours, to be trained in the rules. Whether Mancenus, or
Manchenius, and Mugint were the same person, or the latter the
successor of the former, it is difficult to say. Both appear to have
borne the name of Nennio; but this appellation may have been
applied to the abbots of Candida Casa as the successors of the
founder Ninian. The former name of Manchenius is obviously the
Irish name Manchan; and he is probably celebrated in the Litany of
Angus the Culdee, when he invokes ‘thrice fifty disciples, with
Manchan the master.’[96]
Second channel While this monastic life, which Ireland thus
through Bretagne received from Saint Ninian’s monastery in
and Wales. Galloway, affected mainly the north of Ireland,
the second great channel through which monachism reached Ireland
exercised a powerful and all-pervading influence on her central and
southern districts. In the year 394 Tours was made the capital or
civil metropolis of the province of Lugdunensis Tertia, and became a
metropolitan city. Her ecclesiastical jurisdiction extended over the
provinces now called Bretagne, Maine, and Anjou, with a part of
Touraine; and Saint Martin became the metropolitan bishop. The
monachism introduced into Gaul and fostered by him spread at once
into Bretagne, where the monasteries of Landouart and
Landevenech were founded;[97] and from thence it passed into
Wales. In the Catalogue of the Saints we are told that those of the
second or monastic order ‘received a mass from bishop David, and
Gillas and Docus, the Britons.’ Bishop David is of course the
celebrated Saint David who founded the church of Cillemuine, or
Menevia, now St. David’s. Gillas is no other than the historian Gildas;
[98]
and by Docus is meant Saint Cadoc, who founded the great
monastery of Nantgarvan, or Llancarvan, in South Wales, where
Gildas was also associated with him. From these three eminent
fathers of the monastic church of Wales the monastic institution also
passed into Ireland through Finnian of Clonard. Finnian was of the
race in Ireland termed Cruithnigh, or Picts; and we are told in his
Acts, that after having been instructed in his youth by Fortchern of
Trim and Caiman of Dairinis, an island in the bay of Wexford, he, in
his thirtieth year, crossed the Irish Channel to the city of Kilmuine,
where he found the three holy men, David and Cathmael[99] and
Gildas, and became their disciple. After remaining thirty years in
Britain, partly in the monastery of St. David and partly in other
monasteries in Wales, he returned to Ireland followed by several of
the ‘religious’ Britons, ‘to gather together a people acceptable to the
Lord.’
The school of He eventually founded the great monastery of
Clonard. Cluain-Erard, or Clonard, in Meath, which is said
to have contained no fewer than three thousand monks, and which
became a great training school in the monastic life, whence
proceeded the most eminent founders of the Irish monasteries.[100]
In an Irish Life of Finnian quoted by Dr. Todd in his Life of Saint
Patrick, we are told, that ‘after this a desire seized Finnian to go to
Rome when he had completed his education. But an angel of God
came to him, and said unto him, “What would be given to thee at
Rome shall be given to thee here. Arise and renew sound doctrine
and faith in Ireland after Patrick.”’[101] And in the Office of Finnian it
is said that, ‘when he was meditating a pilgrimage to Rome, he was
persuaded by an angel to return to Ireland, to restore the faith,
which had fallen into neglect after the death of Saint Patrick.’[102]
These expressions all point to an effete and decaying church
restored through the medium of Finnian and his monastic school of
Clonard, and to a great revival and spread of Christianity through a
new and living organisation based upon the monastic institution.
Twelve apostles This great work was carried out by twelve of
of Ireland. his principal disciples, who filled the land with
monasteries, and, as leaders of the new monastic church, became
known as the twelve apostles of Ireland. In the Martyrology of
Donegal Finnian is well described as ‘a doctor of wisdom and a tutor
of the saints of Ireland in his time; for he it was that had three
thousand saints at one school at Cluain Eraird, as is evident in his
life; and it was out of them the twelve apostles of Erin were chosen;’
and it is added, ‘A very ancient vellum-book, in which are contained
the Martyrology of Maelruain of Tamhlacht, and the list of the saints
of the same name, states that Finnian was in his habits and life like
unto Paul the apostle.’[103] Of these twelve apostles the earliest were
the two Ciarans—Ciaran who founded the monastery of Saighir in
Munster, and Ciaran, called Mac-an-tsaor, or ‘the son of the artificer,’
who founded, in 548, the more celebrated monastery of
Clonmacnois in King’s County; Columba, son of Crimthan, a native of
Leinster, who founded that of Tirrdaglas in the same year; Mobhi
Clairenach, who founded the monastery of Glais-Naoidhen in Fingall;
and Ninnidh, whose monastery was in an island in Lough Erne called
Inismacsaint. Somewhat later were Brendan of Birr; the other
Brendan, who became celebrated for his seven years’ voyage in
search of the land of promise, and founded the monastery of
Clonfert, where, like his master Finnian, he ruled as presbyter-abbot
over three thousand monks; and Laisren or Molaisse of Devenish.
Still later were Ruadhan of Lothra, Senell of Cluaininnis and
Cainnech of Achabo, who lived till the end of the century. Of these,
Brendan of Birr and Cainnech of Achabo were, like their master, of
Pictish descent.
Saint Columba, The number of the twelve apostles was made
one of the up by one who was destined to become more
twelve. celebrated, and to leave a more extended and
permanent impression on the church than any of the others. This
was a disciple termed Colum or in Latin, Columba. By paternal
descent he was a scion of the royal house of the northern Hy Neill.
His father, Fedhlimidh, belonged to that tribe of them termed the
Cinel Conaill from Conall Gulban, one of the eight sons of Niall, from
whom they were descended, and was connected in the female line
with the kings of Dalriada. Columba was born on the 7th December
521,[104] and was baptized under that name by the presbyter
Cruithnechan, but became soon known as Columcille or ‘Columba of
the church,’ in consequence of the frequency of his attendance,
when a child, at the church of Tulach-Dubhglaise, now Temple
Douglas, near the place of his birth.[105] When he had attained a
proper age he became a pupil of Finnian, or Finbarr, of Maghbile,
where he was ordained a deacon.[106] He then, while yet a deacon,
placed himself under the instruction of an aged bard called
Gemman, by whom no doubt was fostered his taste for poetry, and
that regard for the bardic order instilled, which led to their
subsequently obtaining his warm support.[107] Thus far the account
of his youth is supported by Adamnan; but we must now trust to the
ancient Irish Life alone for the further particulars of his early
training. Leaving Gemman, he became a disciple of Finnian of
Clonard, under whom he completed his training, and formed one of
that band known as the twelve apostles of Ireland. He then joined
Mobhi Clairenach, one of the number, at his monastery of
Glaisnaoidhen, where he found Ciaran and Cainnech, who had been
his fellow-disciples, and a third, Comgall, who belonged, like Ciaran
and Cainnech, to the race of the Irish Picts, and was destined to
become equally celebrated as a founder of monastic institutions.
Columba thus united in himself the training of both monastic schools
—that of Finnian of Maghbile, derived from the great monastery of
Candida Casa, and that of his namesake of Clonard, derived from
David, Gildas, and Cadoc of Wales. On leaving Mobhi, he probably
obtained priest’s orders, having attained the age of twenty-five
years; but the fact is not recorded in the Irish Life.[108] We are told,
A.D. 545. Founds however, that immediately after the death of
the monastery of Mobhi, who died in 545, Columba founded the
Derry. church of Derry. The account of it given in the old
Irish Life will furnish a good illustration of how these monasteries
were founded. ‘Columcille then went to Daire, that is, to the royal
fort of Aedh, son of Ainmire, who was king of Erin at that time. The
king offered the fort to Columcille; but he refused it, because of
Mobhi’s command. On his coming out of the fort, however, he met
two of Mobhi’s people bringing him Mobhi’s girdle, with his consent
that Columcille should accept a grant of territory, Mobhi having died.
Columcille then settled in the fort of Aedh, and founded a church
there.’ Ainmire, the father of Aedh, and Columba were cousins-
german, the sons of brothers. The grant of the royal fort to him as a
commencement to his ecclesiastical career was therefore not
unnatural. After this he is said to have founded the church of
Raphoe in Donegal, and ten years after the foundation of Daire he
founded at Dair-Mag, now Durrow, in the diocese of Meath, another
church, which is called in the Irish Life a ‘Recles’ or monastery. It is
termed by Bede a noble monastery in Ireland, which, from the
profusion of oak-trees, is called in the Scottish language Dearmach,
that is, the plain of oaks.[109] Besides these, the first and last of
which were his principal monasteries in Ireland, he is said in the
Irish Life to have founded many others, as Cennanus, or Kells, in the
north-west of the county of Meath, which the Irish Life tells us was a
fort of Diarmada, son of Cerbaill, and ‘Columcille marked out the city
in extent as it now is, and blessed it all, and said that it would
become the most illustrious possession he should have in the land’—
a prophecy fulfilled after two centuries had elapsed from his death;
also Clonmore in the county of Louth; Rechra, now Lambay, an
island off the coast of the county of Dublin; Swords, known as Sord-
Choluimchille, in the county of Dublin; Drumcliffe, a little to the
north of Sligo; Drumcolumb in the county of Sligo; Moone in the
county of Kildare; Eas mic n Eirc, or Assylyn, near the town of Boyle;
Easruadh, on the river Erne in Tyrconell; Torach, or Tory island, off
the coast of Donegal; and others not mentioned in the Life.[110]
558.
A.D. In the year 558 the great monastery of
Foundation of Bennchar, or Bangor, was founded in the county
Bangor. of Down, the ancient territory of the Irish Picts,
by Comgall, who was of that race and had been a companion of
Columba at Glaisnaoidhen. It was situated on the south side of
Belfast Lough; and the following account of it is given in his Life:
—‘So great a multitude of monks then came to Comgall that they
could not be maintained in one place, and hence they possessed
several cells and many monasteries not only in the region of the
Ultonians, but throughout the other provinces of Ireland; and in
these different cells and monasteries three thousand monks were
under the care of the holy father Comgall; but the greater and more
memorable of them was the monastery of Bennchar.’[111] St. Bernard,
abbot of Clairvaux, in his Life of St. Malachy, written in the twelfth
century, tells us that Bennchar was given to him by the lord of the
land, that he might build, or rather rebuild, a monastery there; ‘for,’
he says, ‘a most noble monastery had existed there under its first
father Comgall, which, as the head of many monasteries, produced
many thousand monks. This sacred place was so fertile of saints and
so abundantly bore fruit to God, that one of the sons of that holy
fraternity, called Luanus, is said to have been alone the founder of
no fewer than a hundred monasteries, filling Ireland and Scotland
with its offspring, and not only in these, but even in foreign
countries these swarms of saints poured forth like an inundation,
among whom Saint Columbanus, penetrating thence to these our
Gallican regions, erected the monastery of Luxeuil.’[112] Angus the
Culdee in his Litany invokes ‘forty thousand monks, with the blessing
of God, under the rule of Comgall of Bangor,’ but this number has
probably been written for four thousand in the text.[113] The Luanus
mentioned by St. Bernard was Lugidus, or Molua, of Clonfert-Molua,
now Clonfertmulloe, on the boundary between Leinster and Munster,
and his monasteries were mainly founded in the southern half of
Ireland. It was, as we have seen, by the mission of Columbanus to
Gaul that this Monastic Church of Ireland was brought into contact
with the Continental Church. We have already adverted to some of
the external peculiarities which distinguished it from the Roman
Church at this period; and we must now consider more in detail the
features which characterised it in the aspect in which it presents
itself to us in its home in Ireland.
The primitive When we read of such a number of
Irish monastery. monasteries constructed within a short period, so
many of them, too, the work of one saint, we must not suppose that
they at all resembled the elaborate stone structures which
constituted the monastery of the Middle Ages. The primitive Celtic
monastery was a very simple affair, and more resembled a rude
village of wooden huts. We find from the Irish Life of Columba that,
when he went to the monastery of Mobhi Clairenach, on the banks
of the river Finglass, where no fewer than fifty scholars were
assembled, their huts or bothies (botha) were by the water, or river,
on the west, and that there was an ecclais, or church, on the east
side of the river, which was no doubt, as was usual at the time,
made of no better material. Thus it is told of Mochaoi, abbot of
Nendrum, that on one occasion he went with seven score young
men to cut wattles to make the ecclais, or church.[114] When Ciaran
of Saighir, who was one of the twelve apostles of Ireland, proceeded
to erect his huts and church, he is said to have constructed them of
the rudest materials, and when he went into the wood for these a
wild boar assisted him by biting off with his sharp teeth the rods and
branches for the purpose.[115] Coemgen of Glendalough, too, built his
oratory of rods of wood, planks, and moss;[116] and in Conchubran’s
Life of Monenna we are told that ‘she founded a monastery, which
was made of smooth planks, according to the fashion of the Scottish
nations, who were not accustomed to erect stone walls or get them
erected.’[117] The church in these early monasteries was thus, as well
as the huts or bothies for the accommodation of the monks,
frequently built of wood; and the usual name given to this early
wooden church was Duirthech, or Deirthech, of which the Latin
equivalent was ‘oratorium.’ Of this word various etymologies are
given; but the most probable is that contained in an old glossary
which tells us that Duirtheach comes from Dairthech, a house of
oak, and Deirthech from Dear, a tear, that is, a house in which tears
are shed.[118]
It was not till the end of the eighth century, when the ravages of
the Danes and their repeated destruction of the churches by fire
showed the great insecurity of these wooden buildings, that they
began, when reconstructed, to be built of stone, and the cloicteach,
or stone belfry, was then added to the ecclesiastical buildings. Of the
repeated destruction of the wooden buildings by fire the Irish Annals
afford sufficient evidence, and that the cloicteachs were added
through fear of the Danes, is probable from the evidence that they
were not only used as belfries, but also as places of safety both for
the monks and for the valuables in possession of the monasteries.
[119]
The stone churches were termed Damhliag, and are usually
rendered in Latin by ‘templum,’ ‘ecclesia,’ and ‘basilica.’[120] In an
ancient tract of Brehon laws, which treats of the different stipends
given to artificers for their labours, there is a statement of the
payments to be made to the Ollamh Saer, or master builder, who
was required to be equally skilled in the art of building in stone and
in wood, which well brings out the distinction between the modes of
constructing these buildings. In this document we are told that he
was to be paid ‘for the two principal branches of the art as from the
beginning, that is, stone building and wood building, the most
distinguished of these branches to remain as formerly—viz., the
Daimhliag and the Duirthech. Twelve cows to him for these, that is,
six cows for each.’[121]
Attached to the Duirthech was usually a small side building termed
Erdam, or in Latin ‘exedra,’ which was used as a sacristy.[122] There
was also a somewhat larger house which was the refectory, or
common eating-hall, termed the Proinntigh, and in connection with it
a Coitchenn, or kitchen, and when there was a stream of water fit
for the purpose there was a Muilinn, or mill, and in connection with
it a stone kiln for drying the corn. The Ollamh Saer was also to
receive ‘six cows for coicthigis, or kitchen-building, and six cows for
muilleoracht, or mill-building.’ Somewhat apart from the cells of the
monks were the abbot’s house and the house set apart for the
reception of guests, called the Tighaoid-headh, or ‘hospitium,’ and
these two were of wood, as appears from the numerous notices in
the Annals of those buildings being burnt by the Danes;[123] while the
Ollamh Saer is to receive ‘two cows for houses of rods.’ The whole of
these buildings were protected by a circumvallation, sometimes of
earth, or of earth and stone, termed the Rath, or Lios, and in Latin
‘vallum,’ at others of stone, or of earth faced with stone, and termed
Caiseal, the remains of which still exist in connection with several of
these foundations.[124]
The size of these monasteries, as well as the number of monks
which they contained, varied very much, but this did not affect their
relative importance, which depended more upon the position of their
founder and the jurisdiction they possessed from their foundation
over other monasteries which had emanated from the same founder,
or his disciples. The smallest in size appear to have usually
contained one hundred and fifty monks. This was the number in the
monastery founded in the Aran isles by Enda, who was one of those
founders of monasteries who were trained at the ‘Magnum
Monasterium’ of Candida Casa, or Whithern. We find the same
number in the monastery of Lothra, founded by Ruadhan, one of the
twelve apostles of Ireland;[125] and Angus the Culdee in his Litany
invokes ‘thrice fifty true monks under the rule of Bishop Ibar,’ ‘thrice
fifty true monks under the rule of Munnu, son of Tulchan,’ and ‘thrice
fifty true monks with the favour of God in Dairiu Chonaid.’ We have
then a monastery three times as large, when he invokes ‘nine times
fifty monks under the rule of Mochoe of Nendrum.’ The numbers of
seven hundred and eight hundred occur in connection with
Mochuda, when he invokes the ‘seven hundred true monks who
were buried at Rathinn before the coming of Mochuda, upon being
expelled thence to Lismore,’ and the ‘eight hundred who settled in
Lismore with Mochuda, every third of them a favoured servant of
God.’ Then we have a monastery at Lethglin containing fifteen
hundred monks, when he invokes ‘the three hundred and twelve
hundred true monks settled in Lethglin, who sang the praises of God
under Molaisse, the two Ernas, and the holy martyr bishops of
Lethglin.’ Finally, the great monastery and seminary of Clonard, from
whence emanated the twelve apostles of Ireland, contained, as we
have seen, three thousand monks.
The monastic When Brendan, one of the twelve, is said to
family. have been the father of three thousand monks,
and four thousand are said to have been under the rule of Comgall
of Bennchar, or Bangor, it is probable that these numbers included
the inmates of other monasteries, either founded by them or under
their jurisdiction. The aggregate of monks in each monastery was
termed its Muintir, or ‘familia;’ but this word seems to have been
used both in a narrow sense for the community in each monastery
and also in a broader signification, for the entire body of monks,
wherever situated, who were under its jurisdiction.[126] The monks
were termed brethren. The elders, termed seniors, gave themselves
up entirely to devotion and the service of the church, while their
chief occupation in their cells consisted in transcribing the Scriptures.
In the monastery of Lughmagh there were under Bishop Mochta
sixty seniors; and of them it is said—